hit2501 Posted July 7, 2018 Share Posted July 7, 2018 Hi, I'm moving a sphere (red ball) managing its x,y,z positions but I need that the ball leaves a trace of the same color. What could be the best way to achieve this? Thank you. Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 7, 2018 Share Posted July 7, 2018 @hit2501 Are you looking for a fading 'trace' or one which remains? Also, do these need to be strait lines, or follow the object precisely? DB hit2501 1 Quote Link to comment Share on other sites More sharing options...
hit2501 Posted July 7, 2018 Author Share Posted July 7, 2018 @dbawel Hi, I need one which remains (solid color) that follows the object precisely with its 3 coordinates. Quote Link to comment Share on other sites More sharing options...
hit2501 Posted July 8, 2018 Author Share Posted July 8, 2018 I solved it (at least temporarily). I used sprites for each sphere location, is not fancy but it shows the complete path of my sphere, you can check it here: https://wilawara.000webhostapp.com/demos/gopidemo/ Quote Link to comment Share on other sites More sharing options...
QuintusHegie Posted July 8, 2018 Share Posted July 8, 2018 Hi Hit2501, Well 3 solutions come to my mind: 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. 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.). 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 hit2501 and davrous 2 Quote Link to comment Share on other sites More sharing options...
hit2501 Posted July 10, 2018 Author Share Posted July 10, 2018 Thank you Quintus, I'll try your suggestions. I didnt know the Line option, it seems more eficient. 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.