Butterwell Posted November 29, 2015 Share Posted November 29, 2015 When I run this code locally, it's fine, the generated spheres "stay put". On the playground, the generated spheres move with the target (which is the parent of the camera). http://www.babylonjs-playground.com/#RZ2XP#4 Press "C" to generate spheres. Use arrow keys to change movement direction. If I were to guess, this is a difference in what happens with this code: var local_position = new BABYLON.Vector3(0, 0, 0)local_position.z += 40 // Local to World Transformation var to_world_transform = target.getWorldMatrix() var place_at = BABYLON.Vector3.TransformCoordinates(local_position, to_world_transform); (As a side note, how does one get the BABYLON version string?) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 29, 2015 Share Posted November 29, 2015 Hello and welcome I'm sorry but I do not get the problem can you elaborate a bit more? I see a red box moving to me and static spheres for now. One note: the playground already provides an engine and a renderloop. So I cleanup a bit your playground for further investigations: alert(BABYLON.Engine.Version); For version display: alert(BABYLON.Engine.Version); Quote Link to comment Share on other sites More sharing options...
Butterwell Posted November 29, 2015 Author Share Posted November 29, 2015 Thank you, glad to be here. Sure. The cube is static at 0, 0, 0 global. The spheres "should be" static, I think. When served from my local machine (and when running from file://) the spheres are static. The camera is moving in conjunction with it's parent, "target". The sphere appears static because it's moving at the same clip as the target on the playground. You'll if you turn a bit to the left or right (arrow keys) and continue to generate spheres © you'll notice that each new sphere is generated a bit further away. (Again, on my local machine, they get generated right in front of the camera) My code might not be best practice for adding an object right in front a moving target/camera, and any pointers about how to do that another way are appreciated. (I thought it might be a version difference, but both the playground and locally I'm running v2.3.0-alpha) Quote Link to comment Share on other sites More sharing options...
Butterwell Posted November 29, 2015 Author Share Posted November 29, 2015 Notice, also, that the rendering position of the spheres (all uniform size) seems to be different from the camera clipping (terminology?) position of the spheres: they get no bigger yet disappear from view after a while. Quote Link to comment Share on other sites More sharing options...
Butterwell Posted November 29, 2015 Author Share Posted November 29, 2015 Here's a version with no human interaction needed. http://www.babylonjs-playground.com/#RZ2XP#6 Quote Link to comment Share on other sites More sharing options...
Butterwell Posted November 29, 2015 Author Share Posted November 29, 2015 And move everything into createScene, and... Tada! It works. http://www.babylonjs-playground.com/#RZ2XP#7 Compare #6 and #7 The essential difference is that everything is in createScene. Gotta love scoping. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 30, 2015 Share Posted November 30, 2015 lol ! Me too ;D 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.