Jump to content

Update mesh position before physics are applyed


Pryme8
 Share

Recommended Posts

This is prolly a dumb question that has been asked a million times and im pretty sure Ive seen the answer somewhere before but I cant seem to find it now...
http://www.babylonjs-playground.com/#57UUW#2

In my scene I move my meshes prior to adding the physics but it seems that the physics imposter is being created at the original inception point of the mesh? or maybe Im just tripping... so some way I figured I need to run an updateMeshPosition method or an update physics body or something...

Any help here?


***UPDATE*** weird, i did not change anything and it started working... so odd...

Link to comment
Share on other sites

I love the update :)

About the position tracking - the new physics architecture tracks the position you are setting to the mesh. So any change th the mesh's position/rotation (quaternion) will be represented in the physics body. If it doesn't. please let me know. As this would be a bug.

Link to comment
Share on other sites

Since I am all over this car demo, here is a position update demo - http://www.babylonjs-playground.com/#1MSQGK#5

This is, btw, not the best way of updating your mesh's position, but it works. The best way would be to use forces and move your mesh in the right direction. But if you have to set position, set the position.

And another btw - if you once move the car (in this example) the position update won't work anymore. This is the magic of the motor settings and constraints.

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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