Jump to content

Behavior of objects different in playground


Recommended Posts

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).




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?)


Link to comment
Share on other sites

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:




For version display: 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...