OMAR Posted March 20, 2016 Share Posted March 20, 2016 Does Babylon.js have support for Scene hirearchies where you can create Parent and then attach Children to it so that children will be able to inherit some properties from their parent like position and rotation? I'm very new to Babylon.js and right now trying to create a minimalist type of game using Babylon.js in which Camera always moves forward while there is a cube which has to follow the camera as well. Can I make Camera a Parent object while attaching this Cube as its Child so that while Camera is moving the Cube will move too because Cube inherits Camera's position so Cube's position will update accordingly? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 21, 2016 Share Posted March 21, 2016 Hello and welcome Yes Babylon.js has support for parenting. Simply call mesh.parent = camera(or mesh or light) Simple and easy OMAR 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 21, 2016 Share Posted March 21, 2016 Here is a quick example: http://babylonjs-playground.com/#24EIGK OMAR 1 Quote Link to comment Share on other sites More sharing options...
OMAR Posted March 21, 2016 Author Share Posted March 21, 2016 Thank you this is exactly what I wanted GameMonetize 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.