Jump to content

How to leave a trace behind a moving mesh?


hit2501
 Share

Recommended Posts

Hi Hit2501,

Well 3 solutions come to my mind:

  1. Yes you can use sprites. I would recommend to reduce the sprite locations to have a minimum distance (so they don't overlap, which isn't fancy). See the Street Hoops 3D demo on babylonjs.com when you aim the basket ball you see a trail of dots for an example. Hint: Put the Vector3 points into a Path3D to get more useful properties about the trajectory for free.
  2. You can also use the Line mesh to draw a line through the points. See https://doc.babylonjs.com/how_to/parametric_shapes#lines If you have multiple trajectories you can use the LineSystem (and give each ball line a different color etc.).
  3. Finally you can use a Ribbon or mesh extrusion along a Path3D if you want the line to have some sort 'shape' in 3D. E.g. for a ball which is a sphere your line shape will be an extruded Circle to create a (bended) tube. Demo's http://jerome.bousquie.fr/BJS/demos/rollercoaster.html see the track that is constructed along the line path. Also see the docs on extruding a shape along a path.

Maybe there are more ways, but these 3 will probably help you get started.

I use option #2 (for debug) an #3 for my Model Train Simulator game to construct the rail track path.

Enjoy.

Q

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