Jump to content

Search the Community

Showing results for tags 'rotation translation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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 1 result

  1. Despite reading and help from jerome and RananW rotate and translate along with local and world were still getting me confused so to help be grasp what was going on I created a 'pilot' and put him in a 'helicopter' (helicopter has pilot as parent) As a pilot is the centre of his own universe I gave him his own axes (ie each axis has the pilot as parent) I then tried out a variety of sequences which you can try out here. (You will have to change comments around and swap LOCAL and WORLD around as needed) I have put in all the stages to show how my understanding developed and then came to a halt. At first things go as expected, it is when I tried translations following rotations that confusion set in. If you want to find my questions skip towards the end. Initially all these were created at the origin and world axes are also shown. x axis red, y axis green, z axis blue I flew the plane to (2, 2, 0) in two stages pilot.translate(BABYLON.Axis.X,2, BABYLON.Space.LOCAL); pilot.translate(BABYLON.Axis.Y,2, BABYLON.Space.LOCAL); At this point the LOCAL and WORLD axes are parallel and the first parameter of the method translate is just a vector. BABYLON.Axis.X is the unit vector (1, 0, 0) and BABYLON.Axis.Y is the unit vector (0, 1, 0) so I would expect when local and world axes are parallel and in the same direction using LOCAL or WORLD does not matter. As expected the translations are cumulative. Now a clockwise rotation using either world or local. Starting Point for sequences 1 to 4 pilot.rotate(BABYLON.Axis.Z, -Math.PI/2, BABYLON.Space.LOCAL) pilot.rotate(BABYLON.Axis.Z, -Math.PI/2, BABYLON.Space.WORLD) give the same result. The first parameter of the rotate method is just a vector to act as an axle for the rotation and does not allow for a centre of rotation to be specified so this must be set by Babylon.js. So in either case the pilot is still the centre of his world so is the centre of origin and the rotation is around the vector (0, 0, 1) parallel to the z axis. Prior to the rotation the local and world z axis are parallel and so the result will be the same which ever one is used. The next four sequences of movements all start from the above starting point. Sequence 1 Following Starting Point clockwise rotation of PI/2 around LOCAL X axis. pilot.rotate(BABYLON.Axis.X, -Math.PI/2, BABYLON.Space.LOCAL); So in this case as expected since LOCAL is used BABYLON.Axis.X is the x axis in the pilots own local axes system and the rotation is around the vertical axis. Sequence 2 Following Starting Point clockwise rotation of PI/2 about WORLD X axis. At this point the local x axis and the world x axis are no longer parallel. pilot.rotate(BABYLON.Axis.X, -Math.PI/2, BABYLON.Space.WORLD); The centre of rotation is again the pilot and since WORLD is used BABYLON.Axis.X is the world x axis and the rotation is about the vector parallel to the world x axis. Note again that the world rotations are cumulative. Now for translations. Sequence 3 Following Starting Point LOCAL translation in direction of X axis. So what happens after pilot.translate(BABYLON.Axis.X, 5, BABYLON.Space.LOCAL); pilot.translate(BABYLON.Axis.X, 5, BABYLON.Space.LOCAL); WHAT?????. Since I am using LOCAL I would expect, as it was for rotation BABYLON.Axis.X to now refer to the x axis (now vertical) of the pilot's local axes system. So what happens when I tried WORLD for the translation? Sequence 4 Following Starting Point WORLD translation in direction of X axis. So what happens after pilot.translate(BABYLON.Axis.X, 2, BABYLON.Space.WORLD); pilot.translate(BABYLON.Axis.X, 2, BABYLON.Space.WORLD); WHOOPS????? the BABYLON.Axis.X has now been taken in the direction of the pilot's local axes system even though I have set it to WORLD. Are my expectations confused or is something wrong? I tried something simpler using WORLD. Went back to creating the pilot and helicopter at (0, 0, 0) and translate using . Sequence 5 A World translation in the X direction followed by one in the Y direction pilot.translate(BABYLON.Axis.X,2, BABYLON.Space.WORLD) followed by pilot.translate(BABYLON.Axis.Y,2, BABYLON.Space.WORLD); the result was The first translation has been wiped - no accumulation. This also happened using multiple translations and WORLD -only the last translation was taken. QUESTIONS In the translate method have WORLD and LOCAL got exchanged or has my brain blown? Following a sequence of translates why does only the last translation take place?
×
×
  • Create New...