Motion in Real Time

Started by
1 comment, last by Colin B 22 years, 3 months ago
I know this is a very newbie-type question but, so what, I''m a newbie =). How do I make things move about in real time? I know how to rotate a cube, but how do I, for example set a path? Thanks in advance! =)
Advertisement
I think the best way to do this would to be as follows:
psuedo code:

/*define a class for the waypoint object similar to:

class _waypoint
{
public:

int id;
float cords[3];
_waypoint *next;

};
*/


/*Put the desired cordinates of each waypoint in the new waypoint object
*/

waypoint_cords(cordinates)



/*
Then in main follow the waypoints along sort of like a linked list
*/
loopthroughwaypoints()
also I think even better you might want to do kind of a keyframing thing where you can say move from here to here in so many seconds.

So lets say the object moves 20 units in 10 seconds. It would move 2 units every second. This would make it more configurable.

In order to move you have to do a little algebra to figure out the equation of the line given the 2 points (your current position and the destination). Plus if you plan to have the object rotate so that it lines up with the new point then moves forward it takes a little trig.

Not sure how much you know about that stuff yet. I often have to look that stuff up myself

A CRPG in development...

Need help? Well, go FAQ yourself.

"Feel free to utilize Pouya''s cliff." - Fel
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

This topic is closed to new replies.

Advertisement