(3D) Deterministic Bounce Prediction
Introduction
What do I Learn?
Objects
Emitter GameObject
The emitter game object does all the real work in the sample scene and houses:
The trick shot component is used to predict a trajectory and "shoot" a projectile that will obey that planned path e.g. a Ballistic Path Follow projectile. This allows for accurate deterministic prediction of bounces and collisions, the ability to handle unexpected (dynamic) collisions and changes to the environment.
Constant Acceleration simply calculates a new constant acceleration value to apply to the Trick Shot in each frame. It is an optional component and not really needed for this demo but is included here so you can play with it and see its effect. Try adding a Local Constant with a small effect on the x such as (1, 0, 0) ... doing so you should see that the projectile curves to the right as if under the influence of a Magnus effect (spin of the projectile)
You don't have to use this component if your game only needs a simple global value such as Gravity but it can be useful or just fun to use so give it a try.
The trick shot line component is used to control the Line Renderer and draw the resulting path. It simply reads the prediction from the Trick Shot component and updates the points displayed by the Line Renderer.
Sphere GameObject
A simple stand-in for our projectile which uses the Ballistic Path Follow component to track the planned path. The options on Path Follow describe how the projectile will react to various conditions, such as rather or not it should resume a traditional dynamic physics simulation at the end of the path or on an unexpected collision.
Last updated