reddozen Posted November 17, 2013 Share Posted November 17, 2013 Is something wrong with the parent designation? Please take a look at these 2. With parent all my scene objects get rotated when the main map is set to the parent.clone.parent=mainTerrain; Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 18, 2013 Share Posted November 18, 2013 This is because the mainTerrain has rotation and so transmit it to its children Quote Link to comment Share on other sites More sharing options...
reddozen Posted November 18, 2013 Author Share Posted November 18, 2013 //mainTerrain.rotation = new BABYLON.Vector3((0*(2*Math.PI/65536))-1.57, (0*(2*Math.PI/65536)), (0*(2*Math.PI/65536))); The rotation is commented out like every other rotation in the file. Also, no rotations are happening after the clones are assigned the mainTerrain parent. So I'm not sure how simply assigning it to a parent would alter it's rotation. The terrain isn't rotated in the scene, and it's base orientation is no different than the other objects in the Babylon file. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 19, 2013 Share Posted November 19, 2013 could try with mainTerrain.rotation = new BABYLON.Vector3(0, 0,0) Quote Link to comment Share on other sites More sharing options...
reddozen Posted November 19, 2013 Author Share Posted November 19, 2013 oddly it works, but i dont get why. do children take on all rotations etc even if they're done before yo set the parent? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 19, 2013 Share Posted November 19, 2013 Hiérarchies are evaluated on every frame actually. Quote Link to comment Share on other sites More sharing options...
reddozen Posted November 19, 2013 Author Share Posted November 19, 2013 So essentially getting everything rotated into positions prior to setting it's parent is pointless? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 19, 2013 Share Posted November 19, 2013 I'm afraid yes:) Quote Link to comment Share on other sites More sharing options...
reddozen Posted November 19, 2013 Author Share Posted November 19, 2013 Ok, then what about rotations or positions made to children after setting the parent? Those will stay where they are directed I assume. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 19, 2013 Share Posted November 19, 2013 Correct Quote Link to comment Share on other sites More sharing options...
reddozen Posted November 19, 2013 Author Share Posted November 19, 2013 Just to add a clear "Answered" thread. parent:Hierarchies are evaluated on every frame.So any rotations, or translations/positions made to the parent prior to assigning it to children will also be applied to the children when parent is assigned. All rotations, or translations/positions made after assigning a parent to a child will be maintained with the child in relation to the parent. Basically in simple terms, don't rotate or move a child until after you've assigned it to the parent, and keep in mind that additional rotations will be in relation to the parent after the parent rotations are applied to the child. Quote Link to comment Share on other sites More sharing options...
Xanmia Posted March 2, 2014 Share Posted March 2, 2014 Would it be possible to add this detail to the rotation and scaling tutorial(https://github.com/BabylonJS/Babylon.js/wiki/03-Rotation-&-Scaling)? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 3, 2014 Share Posted March 3, 2014 Done! Xanmia 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.