Open pookage opened 3 years ago
If we want to do a simple trajectory then a THREE.LineCurve3
should be fine to draw the trajectory, which we can then call .getPoint(alpha)
on to get the correct point in 3D space.
That said, it probably makes more sense to use a THREE.CatmullRomCurve3
instead, which would allow us to create trajectories later if we wanted to create different ammo types / guns etc.
To get the alpha
value for .getPoint
:
age
to 0
tick(time, deltaTime)
function, we add deltaTime
to the age
alpha
as age / lifespan
blaster-bolt
componentraycaster
as a dependency withobjects: .blastable
range
property which defaults to5
lifespan
property which defaults to1000
raycaster
component that points 1m aheadgeometry
component with a cylinder primitiveplay()
, theblaster-bolt
component should draw a line path from its spawn position torange
meters directly ahead given the rotation of the entityblaster-bolt
should translate the attached entity along the path so that it reaches the end bylifespan
ms.blaster-bolt
reaches the end of the path it should return itself toscene.components["pool__blaster-bolt"]
viareturnEntity()