11-30-2014, 03:11 AM
I'm working on integrating Curvy into my 2D space shooter game. I have some ships currently set to a forward direction of 0,-1 so they move down in the Y direction. These work great by applying a force in the forward direction * speed such as
However, when I have a ship following a CurvySpline, it's transform.forward.x and transform.forward.y always equal zero and adding force just ends up with the projectile not moving at all. How do I get the facing direction of an object following a CurvySpline so I can shoot my projectiles in the correct direction?
Code:
lasers[laserIndex].rigidbody2D.AddForce(transform.forward * 3500.0f);
However, when I have a ship following a CurvySpline, it's transform.forward.x and transform.forward.y always equal zero and adding force just ends up with the projectile not moving at all. How do I get the facing direction of an object following a CurvySpline so I can shoot my projectiles in the correct direction?