pookage / ar-turret-game

0 stars 0 forks source link

Define a blaster-bolt component and mixin #5

Open pookage opened 3 years ago

pookage commented 3 years ago
pookage commented 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.

pookage commented 3 years ago

To get the alpha value for .getPoint:

  1. When the animation begins, we set age to 0
  2. In the tick(time, deltaTime) function, we add deltaTime to the age
  3. We can derive alpha as age / lifespan