Advertisement

lesson 10 help

Started by March 09, 2002 05:09 PM
4 comments, last by ryan_carter87 22 years, 11 months ago
Ok I have inserted the (float)cos(heading*piover180) * 0.05f; into my program. But still when i try to move on the zaxis it just spins in a circle, Do I need to define float heading somewhere? Because all i can find in the source code is its initialization.
Ok I finnaly got it to work, now another problem has come up though. It moves forward and backward fine when i havent rotated it on the y axis any. But when i rotate left or right, it doesnt move forward and backward, it moves to the side. How do i make it move forward or backward no matter what direction i am looking at on the yaxis? Thanx
Advertisement
you have to keep track of the angle you are facing and use sin and cos to move you on both the x and z axes.
-------------------------------------------------------BZZZZTT - CRASH - BANG"What was that?!""Captain, it appears that we have encountered a strange sub-space anomaly. I'm getting a high reading of tracheons beams. The anomaly seems to be some kind of rift in the space-time continuum. -- Never mind, Bones was just using the microwave again."
Ok thanx. How do i keep track of the angle?
What you need to do is make a

int Angle; // Or somthing like that

and then use

x = speed * float(sin(Angle)) or something like that

I am crap with maths so its probly wrong, actuly im sure it is

i lost my code for that and have forgotten how to do it



----- ShCiPwA -----
----- ShCiPwA -----
Ya i know to use the sin and cos but i cannot get it to work still. Does anyone else have any suggestions? Thanks

This topic is closed to new replies.

Advertisement