Search the Community

Showing results for tags 'rotation'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 164 results

  1. Hey guys! thanks for all the answers in the other topic, those helped me a lot ;). I have a doubt, how can I set a min angle and max angle for my camera rotation? because I don't want my camera to rotate 360° . What I tried is to let a little box to follow the camera and it has a collision with some walls in order to stop showing the part I don't want to. it worked but the effects are really ugly. That's is solution, as I mentioned It's has some ugly effects and is not always exact. var prevTarget= jQuery.extend(true, {}, camera.getTarget()); //OP1 scene.registerBeforeRender(function () { for(var i in objs)//the walls I mentioned if (objs[i].intersectsMesh(sphere, true) && scene.isReady()) camera.setTarget(prevTarget); prevTarget= jQuery.extend(true, {}, camera.getTarget()); }); //or //OP2 (more precise) setInterval(function(){ for(var i in objs) //the walls I mentioned if (objs[i].intersectsMesh(sphere, true) && scene.isReady()) camera.setTarget(prevTarget); prevTarget= jQuery.extend(true, {}, camera.rotation); },0.1); I hope a better way to do it, thanks guys for supporting us
  2. Hi, I'm trying to figure out how to rotate a FreeCamera on Z axis without using a handler. In this example http://www.babylonjs-playground.com/#1CEZ5W#0, I only can rotate the camera using the handler. You can comment/uncomment the rotation lines in the renderLoop in order to see the difference. Do you understand what I want to show ?
  3. Hi Babylon Community! For the last couple of hours I have been struggling with mesh rotations, and to be honest at this moment I simply have no idea how rotations work in Babylon. I created a simple PG here http://www.babylonjs-playground.com/#LOSW9#1 Basically, I want all the colorful planes in this PG to be perpendicular to the ground (I have tried everything and it's been painful for me so far) Somebody plz help ;__;
  4. Hi all. I just started using Phaser, and I’m excited by the potential. I could use some help with some problems in this game: http://davebsoft.com/web-games/invisible-maze/ https://github.com/dcbriccetti/web-games/commit/d814fe45a655e8fc0916149156fca95cb22c7a3c#diff-ad4eb6229e24f5cc681cc10695f640ca When the player character hits the “mines” (lightning bolts), he rotates. I don’t want him to. Sometimes the mines move about “aimlessly”. I don’t want them to move (except perhaps a little when the player character bumps them). I’ve looked at several examples and read some of the source code, but I feel like I’m still sort of guessing about a lot of things. Perhaps someone could give the code a quick general review? Thanks!
  5. changing rotation from quaternion to euler resets the mesh rotation consider this http://www.babylonjs-playground.com/#ZTNIZ Here I am just rotating the cube by 45 degree around y axis. This works as expected. Now just convert the rotation to euler http://www.babylonjs-playground.com/#ZTNIZ#1 And the cube goes back to its previous rotation !!
  6. Hello, I read in the doc that rotation is achieved before translation, but I try to have an offsetted object rotate around the 0,0,0 axis and I cant find any way to achieve this ... usualy(with other engines) I offset the object on its local axis then simply rotate it globaly with a matrix/quaterion/rotate function I tried different combinations of these two mesh.translate(BABYLON.Axis.X, 3.0, BABYLON.Space.WORLD); //or LOCAL mesh.rotate(BABYLON.Axis.Y, 1.0, BABYLON.Space.WORLD); //or LOCAL (I wanted to rotate the object position with a quaternion, but the Quaternion lacks of regular/usual .mult(Vector) or .rotate(Vector) and anyway, it wouldn't be what I want to achieve) any idea ? thanks
  7. Hi, The post title might be a bit of a misleading one as I do not have a real problem with the code itself, but the thinking process around it. What I'm trying to accomplish is the following: aiming and shooting an object based on drag distance and drag direction, etc. When dragging the mouse I want a line to appear into the direction the object is going to be shot. I have no problem with making the line appear, shooting the object etc, but I do have a problem with the correct direction. I've been trying to accomplish what I want with the rotation property, but I'm getting nowhere I want to get at. I totally suck at explaining what I'm trying to accomplish, but the best example is the app (game) bbtan in which the aiming functionality is exactly as I'm trying to accomplish, except for the fact I want to be able to aim downwards too. In the following youtube video you can watch some gameplay of the bbtan game. https://www.youtube.com/watch?v=WISOyBzd9J0 p.s.: I'm not trying to make a copy of bbtan, yet their aiming method is what I need.
  8. can anyone check this http://www.babylonjs-playground.com/#1EIE9G#0 steps to reproduce : 1st rotate around X then rotate aroung Y if you notice the color or another Box is changed cay anyone tell me why please help me I'm new hear
  9. This is how I load the tilemap, instantiate a background layer and get the object layer for it: // preload levelgame.load.tilemap( "tilemap", "assets/levels/tilemap.json", null, Phaser.Tilemap.TILED_JSON );game.load.image( "tiles", "assets/levels/tileset.png" );var map = game.add.tilemap( 'tilemap' );map.addTilesetImage('tile-set', 'tiles');// create background layervar layer = map.createLayer( backgroundLayerName );// get objects from the object layervar levelObjects = map.objects[ objectsLayerName ];levelObjects.forEach( function( element ) { //...} );I get the position and name properties, but there is no rotation. I've made sure tiliemap.json has the rotation values for every object. I am trying to use the Arcade physics engine, could this be the reason? Thanks.
  10. Hi there, how can I disable P2 physics rotating specific body while still be able to use body.rotation property ? I tried kinematic but it ruins collision
  11. Hi, Here is my example. Code works so that perplexus(mesh) is rotated around it's center. With Key 1,2 around Y, with key 3,4 around X and key 5,6 aroudn Z. Can anybody help me to solve how to rotate perplexus(mesh) around current center of payBall(mesh)? http://86.58.118.110:8080/BabylonBall/Main.html if I add code var currentCenterPlayBall = perplexusRef.playBall.getBoundingInfo().boundingSphere.center; I get currentCenterPlayBall (x,y,z). How can I rotate perplexus Mesh around currentCenterPlayBall this current (x,y,z) ? switch (keycode) { // user inputs case 49: // 1 perplexusRef.perplexus.rotate(BABYLON.Axis.Y, Math.PI / +512, BABYLON.Space.LOCAL); perplexusRef.perplexus.updatePhysicsBodyPosition(); brake; case 50 : // 2 perplexusRef.perplexus.rotate(BABYLON.Axis.Y, Math.PI / -512, BABYLON.Space.LOCAL); perplexusRef.perplexus.updatePhysicsBodyPosition(); break; case 51 : // 3 perplexusRef.perplexus.rotate(BABYLON.Axis.X, Math.PI / +512, BABYLON.Space.LOCAL); perplexusRef.perplexus.updatePhysicsBodyPosition(); break; case 52 : // 4 perplexusRef.perplexus.rotate(BABYLON.Axis.X, Math.PI / -512, BABYLON.Space.LOCAL); perplexusRef.perplexus.updatePhysicsBodyPosition(); break; case 53 : // 5 perplexusRef.perplexus.rotate(BABYLON.Axis.Z, Math.PI / +512, BABYLON.Space.LOCAL); perplexusRef.perplexus.updatePhysicsBodyPosition(); break; case 54 : // 6 perplexusRef.perplexus.rotate(BABYLON.Axis.Z, Math.PI / -512, BABYLON.Space.LOCAL); perplexusRef.perplexus.updatePhysicsBodyPosition() break; Any help? greetings Any help? greetings
  12. Hi! I'm rotating a group clockwise and counter clockwise with a button that does mygroup.rotation += 90; //for clockwise mygroup.rotation -= 90; //for counter clockwise but the group, rotated from its center, does not rotate 90 degrees... why? It rotates sometimes more or less, but never 90 degrees... Any ideas? I'm not using physics. Thanks
  13. Hi All, I'm facing a problem with rotations of boxes. Basically I need to rotate a cube by 90° around the system axes, but I noticed that when a box has a rotation set, say on x axis, if you set a rotation on z, actually you're rotating the mesh around the global system Y axis. Does rotation property refer to a coordinate system that is "local" to the mesh ? How can I calculate the correct x,y,z rotation with respect to the global axes ? Thanks in advance P.S. I have created a simple playground for this: http://babylonjs-playground.com/#NJJPP#0 If you click once on "rotat.around x" then when you click "rotat.around.z" (more than one time to notice the rotation) you will get a rotation around global Y axis. But if you only click on the same button multiple times (refreshing the page to reinitialize when you decide to change the button) the rotations are performed around the right axis.
  14. When I change a sprite it's rotation with *.rotation, *.angle or *.pivot, it also changes the position because the center of the sprite will change. I'm making a game with a grid and it makes my sprites fall out of their tiles, how can I prevent this? Also here are some example pictures: Normal http://i.imgur.com/V8FRJ3M.png Anchor 0.5 http://i.imgur.com/xLoEpZi.png Angle 90 http://i.imgur.com/x1YtRnn.png
  15. Hi guys, I'm sure people have come across this before, but I'm wondering whether it would make sense to use groups for orbital sprites. I'm trying to set up a typical orbital shield using rotation, and thought it would be cool to add many sprites to the orbit. I've got it working well enough with a single sprite, but adding additional balls seems to result in them colliding immediately, gaining velocity, and spinning out of orbit. Is it even worth using a group for something like this, or would I be better off using individual sprites like in this example? Here's what I'm doing so far, and I haven't tried to add any code for collisions yet but the idea is to block enemy shots with the orbs. I'm not sure why the orbs collide with themselves in the group since they don't collide with anything else in the game yet, but I think using p2 to get collision handlers would be the next step. export class PsiBall { constructor(game, player) { this.game = game; this.player = player; this.psiballs = game.add.group(); this.addBalls(10); this.psiballs.parent = player; this.psiballs.enableBody = true; this.psiballs.physicsBodyType = Phaser.Physics.P2JS; this.psiballs.pivot.x = 5; } rotate(speed) { this.psiballs.rotation += speed; } createBall(x, y) { let ball = this.psiballs.getFirstDead(); ball.reset(x,y); } addBalls(count) { for(let i = 0; i < count; i++) { let psiball = this.psiballs.create(0, 0, 'item-57', 0, false); this.game.physics.p2.enable(psiball); psiball.scale.setTo(0.5); psiball.smoothed = false; psiball.anchor.setTo(0.5); psiball.enableBody = true; } }}
  16. Right now I am trying to figure out how to make my character's eyes rotate and orient towards a camera. I am attaching my babylon file to this, but what I am hoping to do is create a lookAt function for the eyes. Is there an easy way that I can set the local rotation for the eyes so that they follow the camera, or any object in 3d space? The pivot point of the eyes is in the center of the eyes so they should rotate without a problem. I realize that the idea of the forum is to contribute to the solution as well, but I am a little lost as to where to start. Is there some information on the web that can help as well? Thanks. I attached the babylon file in case anyone wanted it. content.zip
  17. Hey folks, I am using a FreeCamera and want to be able to rotate all the way around the x-axis but the rotation always stops when I look straight down. I searched the forum and the web but I couldn't find a setting to disable that. Is that a technical limitation or is it somehow possible to create a workaround? Not sure how useful a playground for that question is, but better to have on than not to http://www.babylonjs-playground.com/#22PVJH You start looking at a sphere, then look down, you will see another sphere and the ground. If you are there, you can't look down an further. I would like to be able to keep going. Like sitting in a spaceship with no real down. You know what I mean?
  18. I have a clock with hands for hour, minute, and second. While it is not a problem to rotate the hands according to the correct time, I am not getting the correct time. It seems like the hands are opposite where they are supposed to be. Exactly opposite. I put together a playground demo to show what I am doing. Has anyone had experience with this? This same formula was working correctly in THREE.js. http://www.babylonjs-playground.com/#1JK5E8#8 Thanks in advance
  19. Hello, I want to make it so that a plane mesh follows the camera (i don't want to use billboard mode for...reasons), which it wouldn't be hard to do (set rotation.y equal to camera.alpha, and it works fine) but since the plane has been previously rotated using the "lookAt" function now it uses Quaternions which i can't really grasp how they work at the moment. Is there a way to just set the rotation of a mesh to a certain value without having to use quaternions, or a way to convert a Vector3 rotation into a quaternion rotation?
  20. I'm trying to create a simple game involving a fish following the pointer by replicating and modifying this code: http://gamemechanicexplorer.com/#homingmissiles-1 (BTW great site for noobs.), but the entire missile/fish rotates towards the pointer in this example, while I don't want the sprite to rotate. How can I achieve this? Also how can I add animation to the missile while it is chasing and while it is turning by 180 degrees? Any help is appreciated.
  21. Hello folks, I have here a code to rotate my car object: //turnSpeed is a fraction of the car's current speed so that the car can't rotate without moving forwardturnSpeed = speed / 6000; //these conditionals are true when the buttons on the screen are touched if (rightArrowLeftIsPressed) { playerCar.rotation += turnSpeed; } if (leftArrowLeftIsPressed) { playerCar.rotation -= turnSpeed; }//if no button is pressed, the car should snap to a wind direction if it's already close to one else { if (playerCar.rotation < 0.15 && playerCar.rotation > -0.15) { playerCar.rotation = 0; } if (playerCar.rotation > (Math.PI - 0.15) || playerCar.rotation < (-Math.PI + 0.15)) { playerCar.rotation = Math.PI; } if (playerCar.rotation > -Math.PI / 2 - 0.15 && playerCar.rotation < -Math.PI / 2 + 0.15) { playerCar.rotation = -Math.PI / 2; } if (playerCar.rotation > Math.PI / 2 - 0.15 && playerCar.rotation < Math.PI / 2 + 0.15) { playerCar.rotation = Math.PI / 2; } }For some reason, pressing the rightArrowLeft button works only until the car reaches a rotation of 0, 90, 180 or 270. Then, it snaps to that direction without rotating further. The leftArrowLeft button, to rotate counterclockwise, works without any problems. Anyone have any idea why this would happen? Thanks
  22. Hi guys, See my demo about this issue: http://phaser.azurewebsites.net/runner2/ Set the pivot to rotate the sprite doesn't work Regards, Nicholls
  23. Hi all, I'm playing around with PIXI and using what I know of autonomous agents in Processing to help me along the way. I used Processing extensively about 2 years ago and integrated a lot of Craig Reynolds' work into my projects (ie autonomous agents, steering, boids etc). To learn that I used the wonderful book The Nature Of Code by Daniel Shiffman. Chapter 6 of this book is on autonomous agents and moves from steering into a boids algorithm using Processing. The section related to my question is "Example 6.1: Seeking a target" (if you can visit the page for Chapter 6 - Autonomous Agents and look at Example 6.1 as it has an embedded applet showing the intended results of what I'm trying to achieve. Note how nicely the triangle just turns to be facing the direction it is moving). I've been able to rewrite most of that example in JS/PIXI but I'm having trouble with the vehicle rotating to face the mouse. The relevant section from the full Vehicle Class code is: // Draw a triangle rotated in the direction of velocityfloat theta = velocity.heading2D() + PI/2; //this line in particularfill(127);stroke(0);strokeWeight(1);pushMatrix();translate(location.x,location.y);rotate(theta); //the Vehicle is rotated by the angle calculated by heading2D() abovebeginShape();vertex(0, -r*2);vertex(-r, r*2);vertex(r, r*2);endShape(CLOSE);popMatrix();What I cannot figure out is how to translate the float theta = velocity.heading2D( ) + PI/2; line into something usable by PIXI and then correctly rotate the triangle primitive I have drawn with PIXI.Graphics( ). My 'Vehicle' is also an object that draws the triangle and moves towards the mouse and does everything expected except rotate to always the direction it is travelling. My current line of code to attempt to replace the PVector.heading2d( ) method from Processing is this.heading = Math.atan2(this.velocity.x, this.velocity.y);Which is followed up elsewhere with graphics.rotation = this.heading;I'll admit it's a reasonably blind attempt at hoping to stumble upon a working result as I don't truly understand how to rotate a primitive (filled triangle in my case) by the angle derived from the direction it is travelling. What happens when I run my steering example with the above two lines included is exceptionally erratic rotating - alternating between two rotations so fast in fact that it gives the appearance of there being two triangles. Is someone able to help me understand how to rotate a triangle primitive to be facing the direction it travels as seen in the quoted Processing code line? float theta = velocity.heading2D() + PI/2;I need to implement whatever calculation PVector.heading2D( ) does, but that is what I can't figure out. Many thanks!
  24. people i got this: this.sheep.forEachAlive(function({ nuevodiskette.x = b.body.x; nuevodiskette.y = b.body.y; nuevodiskette.angle = b.angle; b.angle++; }, this);why the two sprites rotates at same speed but in different x and y? they are supposed to be one on front of the other !!?? any idea?