Closed antfarmar closed 8 years ago
Add the velocity of the rigidbody to the bullet. And get rid of those comments I placed there while you are at it :)
Bullet().Fire(nozzle.position, nozzle.rotation, direction * velocity + rb.velocity);
Oh yeah, vector addition. Who knew rigidbodies had a velocity property? :laughing: I also renamed the variables to distinguish scalars from vectors.
Commit a56a4ed
void FireBullet(Vector3 direction, float speedScalar = bulletSpeed)
{
direction = (direction * speedScalar) + rbody.velocity;
Bullet().Fire(nozzle.position, nozzle.rotation, direction);
}
Could probably also just collapse those 2 parameters to simply velocity and have the caller do the math.
Problem
Possible Fixes
Rigidbody
API have any simple functions for this?