Game Development Community

Moving a Car

by Brandon Fogerty · in Technical Issues · 06/02/2008 (7:47 am) · 4 replies

Hi. I want to simulate traffic in my game. The player will should be able to see cars moving back and forth. How do I move a dynamic object from one way point to another? Is the only method to get the objects transformation and then add a vector offset to it or is there a nice and pretty packaged method that will automatically make a dynamic object move to a way point given the way point's transformation?

For example, I know that AIPlayer's have a "setMoveDestination" method which does that exact functionality.
What are my options?

Also, what do "Paths" do in the game editor? I assume they let you setup paths for a dynamic object to take but I don't know how to use them as there wasn't much mention of them in my Troque Game Programmer's guide book. Any ideas? Thanks in advance!

#1
06/02/2008 (10:30 am)
Paths are there for objects to follow, such as AIPlayer. if you open the stronghold mission, and go into the mission editor, you'll see kork is running around a predetermined path.

not many objects support following paths though, since only a few support movement
#2
06/02/2008 (12:58 pm)
Thanks for the response Ramen. So is AIPlayer the only object which has the "setMoveDestination" method? If not, what other kinds of objects can invoke it?
#3
06/04/2008 (3:20 pm)
Just AIPlayr and aiWheeledVehicle have a setMoveDestination function, or something similar as far as I know. This is because player's and vehicle's are the only things which actually "move." If you'd like to have a movement effect on other objects you would have to do things such as setVelocity() or applyImpulse().
#4
07/30/2008 (10:53 am)
Yes i would use the paths feature. The player simply follows a path made up of a set of locations called waypoints.