Simple character movement

Started by
0 comments, last by molehill mountaineer 11 years, 9 months ago
The thing is,I'm very bad at math,right now I'm taking some trigonometry lessons from khanacademy.I know how to use cos,sin,tan without any problems,however,I have a big problem.

I can't seem to find a way to make a dot move.

Suppose I have something like this:

I have a dot. W moves the dot forward,A left,D right and S back.

BUT!! The dot's front must always be on the same line with the camera,something like in a 3rd person game!.

At the beginning the dot is at 0,0,0(x,y,z).If I press W,the dot will go on the positive Z axis,so the dot will have 0,0,1.
The same happens with with A,D,S(that go left,right and back).

The problem here is that this is just a linear movement.What happens when I have to take a curve? Or what happens when I the dot won't be on aimed on the z axis anymore?

You probably know what I'm talking about,I want that dot to take real curves,not just linear movement.And for that we need some trigonometry.

So I'm talking about something like a 3rd person game,where you need curves for realistic movement.If someone has any ideea how to make something like this,please explain with details...
Advertisement
I'm not entirely sure if this is what you're looking for but check out bezier and catmull-rom curves. Basically you use an equation to describe the path on which an asset must travel; catmull-rom being handy in that the object passes all points that you used to define the curve. I used it in the past to implement enemy flight paths in a schmup and it worked pretty well.


Read up here and here and here and google of course

This topic is closed to new replies.

Advertisement