Question about AI player movement
by Ben "Djaggernaut" Chavigner · in Torque Game Engine · 08/10/2006 (8:14 am) · 5 replies
Hello :-),
I need to have an AI player moving to a given case on a grid. Each case has its own coordinates.
When this AI player reaches its goal, I'd like it to face one precise way (say full west or east).
For now, what I've tried didn't worked well at all.
I guess I should use the setMoveDestination method, but I can't find the best solution when the AI player reaches its destination to smoothly face the right side.
Any help would be greatly appreciated, thanks in advance. :)
I need to have an AI player moving to a given case on a grid. Each case has its own coordinates.
When this AI player reaches its goal, I'd like it to face one precise way (say full west or east).
For now, what I've tried didn't worked well at all.
I guess I should use the setMoveDestination method, but I can't find the best solution when the AI player reaches its destination to smoothly face the right side.
Any help would be greatly appreciated, thanks in advance. :)
#2
08/10/2006 (9:33 am)
Thanks Caleb, I'll try that right now. :)
#3
08/10/2006 (10:23 am)
Quick note, if your game crashes shortly after you spawn your shapes, it's torque trying to play the land animation. To fix this, make sure you get your shapes to spawn on the ground.
#4
08/10/2006 (10:43 am)
To get smooth rotations, try this resource. Other than that, what Caleb suggested should work.
#5
Thanks a lot Caleb.
@Stefan: thanks for pointing this ressource, it will surely be pretty useful :)
08/11/2006 (8:14 am)
A quick post to say it worked pretty nice. We even found an other way, but we're still not sure wich one we'll chose :)Thanks a lot Caleb.
@Stefan: thanks for pointing this ressource, it will surely be pretty useful :)
Torque Owner Caleb
Default Studio Name
Create AI players using the spawn sphere shape and name them something like north, south, east and west. When your game is started make them spawn at the four positions you want them.
Then make a function like this:
function AIPlayer::onReachDestination() { //could be north, south, east or even your players name YourAIName.setAimObject(west); }