• Advertisement
Sign in to follow this  

Simple character movement

This topic is 2034 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...

Share this post


Link to post
Share on other sites
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 [url=http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/bezier-curves-and-surfaces-r1808]here[/url] and [url=http://www.mvps.org/directx/articles/catmull/]here[/url] and [url=http://forums.indiegamer.com/showthread.php?4905-Teach-me-splines-for&p=66079#post66079]here[/url] and google of course

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement