Sign in to follow this  
bushimports

Firing a bullet in the right diection and angle.

Recommended Posts

How do I get my bullets to move in the same direction and angle I am facing? I have tried several things but nothing works. I really don't know much about trig or algebra. I tried incorperating the same thing as I did in my passivemotion function to move/rotate the camera but that didn't work either. Much Thanks L.J.Bush

Share this post


Link to post
Share on other sites
Have a position vector and a direction vector.

currentBulletLocation = vector(0,0,0);
//bulletDirection is a unit vector +1 on the z-axis
bulletDirection = vector(0,0,1);


//every frame, do this:
currentBulletLocation += bulletDirection;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this