Render Path3D from physics simulation

Hi :slight_smile:

I’m following this example https://playground.babylonjs.com/#2DLXYB#0 to create a path of a physic simulation in this playground https://playground.babylonjs.com/#93HGU7#88 but I can’t make the line render. It’s probably because has been rendered after createScene ended (it’s inside a setInterval) but I can’t find a away to update the scene with this line, I’ve tried scene.update() without success.

PS: For now the path is created when the simulations end, but I do want to create the path while the simulation is running

Thanks

Hello!

You have to call update on the Path3D object itself, and also update the line system by calling CreateLines with the system itself as the instance parameter: Update Path3D | Babylon.js Playground (babylonjs.com)

1 Like

For some reason it didn’t work, also if I push a new Vector3 to the points list and try to update the Path3D it throws an error (commented line 690) :frowning:

Here is the exalple:

1 Like

update only works with the same size as it tries to be constant in memory size.

About the other issue, you need to clone the position or you will have all position referencing the same vector: https://playground.babylonjs.com/#93HGU7#92

3 Likes

Thank you @sebavan :smiley:

1 Like