问题
The goal is to reproduce a light trail similar to the image below in SceneKit. The trail doesn't need to be as detailed, but the idea is to achieve a similar visual effect.
We tried using thin cubes with opacity around 0.5. We strung about 200 together and attached them to a node to act as a light trail. That was not performant at all.
This other post suggests using particle emitters, but we also need to detect collisions when another object hits the trail. Class documentation says collision detection with particle emitters is also not performant.
Any suggestions on the best way to do simulate a similar light trail?
Some considerations:
1) Like in the Tron game, these light trails will grow in length. For basic bounding, assume there will be 2000 - 4000 nodes compromising these light trails (roughly 200 per player). We can drop FPS to around 30.
2) Are these trails better composed with images/meshes from a designer or constructing them out of SCNShapes?
3) The light trails must be capable of detecting collisions.
Thanks for the help!
回答1:
Particles can be emitted from geometry, with its bounds, from vertices of the geometry or from randomly all over the surface of geometry. It's not a complete example of this, but here's a partial example of using vertices to do that:
Example from three.js but how to implement using SceneKit?
Because of this, you can create geometry, on the fly, that matches the paths of your bikes, and have them emit particles from their top and bottom edges. But I'm yet to figure out how to make them do so in a way that's indicative of the force/energy/maximum trail being just behind the bike, and then fade out, without having to do complex deformation of a physical trail geometry...
来源:https://stackoverflow.com/questions/42019638/scenekit-advice-on-reproducing-glowing-light-trail-like-with-tron-light-cycles