How can a bot can turn smoothly like splines on a path?
by M. Stolley · in Torque Game Engine · 01/18/2005 (7:40 am) · 13 replies
Hi,
now that i can make a path i just wonder how my bot can turn around smoothly.
Till now he came from one pathpoit to the other.
There he turned directly to the new one and go traight to the new pathpoit.
It looked robot like.
How can i make it that the bot turn like splines in Photoshop or so.
He should beginn turning before he reach the pathpoint and after he passed the pathpoint he should complete the turn. So that it looked smooth.
Thank you
Mathias
now that i can make a path i just wonder how my bot can turn around smoothly.
Till now he came from one pathpoit to the other.
There he turned directly to the new one and go traight to the new pathpoit.
It looked robot like.
How can i make it that the bot turn like splines in Photoshop or so.
He should beginn turning before he reach the pathpoint and after he passed the pathpoint he should complete the turn. So that it looked smooth.
Thank you
Mathias
#2
The first one do not look like i want it.
The second is perhaps what i am searching for.
I am trying the AIvehicle threads just now.
I just try the code from Brian Richardson.
And the third, oh man, i am just a beginner :)
Thank you
Mathias
01/18/2005 (10:40 am)
Thank you for your hints.The first one do not look like i want it.
The second is perhaps what i am searching for.
I am trying the AIvehicle threads just now.
I just try the code from Brian Richardson.
And the third, oh man, i am just a beginner :)
Thank you
Mathias
#3
01/18/2005 (10:45 am)
There should be a resource for this somewhere.. search the site.
#4
01/18/2005 (11:05 am)
You can modify the way the AiPlayers generate the aiMove. Maybe you can interpolate the previous destination vector to the new destination vector, and use the interpolated result as destination. That way the bots will make curves before reacing the new destination.
#5
01/18/2005 (11:26 am)
If you're going to go far as modifying how the aiMove is generated, just use your path points as the control points of a spline.
#6
If you want to follow the spline better, you can do what Bruno suggests and add more points to your path. Or, you can make some code changes so that the bot will use the spline calculations to calculate it's next destination point.
That would involve taking the CameraSpline code and adding some methods to SimPath to give you positions between each of the path points.
If you're starting out, I'd use Bruno's method first.. ;)
Thanks,
Brian
01/18/2005 (11:31 am)
A little thing to keep in mind is that the code that draws the paths uses splines, but the path following code just drives/walks towards the next PathPoint.If you want to follow the spline better, you can do what Bruno suggests and add more points to your path. Or, you can make some code changes so that the bot will use the spline calculations to calculate it's next destination point.
That would involve taking the CameraSpline code and adding some methods to SimPath to give you positions between each of the path points.
If you're starting out, I'd use Bruno's method first.. ;)
Thanks,
Brian
#7
I just try your aiwheeledvehicle.zip
and it will not run.
Maybe you can tell me, can i use the fps.starter kit or must i use racing starter kit?
Do i need the code from the vehicle tutorial from codesampler?
Sorry, i read what i must do on your resource page and all be god but then i miss something. What must i do then after i do what you write?
Mathias
@Brian again
here i have asked also.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6222
01/18/2005 (11:57 am)
@BrianI just try your aiwheeledvehicle.zip
and it will not run.
Maybe you can tell me, can i use the fps.starter kit or must i use racing starter kit?
Do i need the code from the vehicle tutorial from codesampler?
Sorry, i read what i must do on your resource page and all be god but then i miss something. What must i do then after i do what you write?
Mathias
@Brian again
here i have asked also.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6222
#8
What i really want is what a car that follows a path can do for me.
It will turn smooth into the curves and that also up and down.
Now that i looked to the resource of Brian Richardson it seemed that this is the solution for my problem.
So for tests i tryed it with a bot but only to figure out how to do pathes and pathfinding and then my next step was to think about curves and i tryed it with the bot.
So my question was a wrong!
It must be called "How can i make that my car will follow a path"
(and after that "How can my car change the path at the end of the first path to a second (left path or right path)depending a result that i will ask the engine?)
So please excuse.
But i thought about the other solution also and be thankfull for your suggestions.
Mathias
01/18/2005 (12:10 pm)
Ok, i just think about it.What i really want is what a car that follows a path can do for me.
It will turn smooth into the curves and that also up and down.
Now that i looked to the resource of Brian Richardson it seemed that this is the solution for my problem.
So for tests i tryed it with a bot but only to figure out how to do pathes and pathfinding and then my next step was to think about curves and i tryed it with the bot.
So my question was a wrong!
It must be called "How can i make that my car will follow a path"
(and after that "How can my car change the path at the end of the first path to a second (left path or right path)depending a result that i will ask the engine?)
So please excuse.
But i thought about the other solution also and be thankfull for your suggestions.
Mathias
#9
Adding an AIVehicle involves modifying the engine as well. Look at This thread it may help you with some common problems.
01/18/2005 (12:52 pm)
@MathiasAdding an AIVehicle involves modifying the engine as well. Look at This thread it may help you with some common problems.
#10
01/18/2005 (1:08 pm)
Thank you Bruno
#11
Are you getting any error messages? Anything in the console? etc..
01/19/2005 (8:23 am)
The resource should work with the starter.fps, but you do need to follow the engine mod parts correctly. Then define a path within the mission for the bot to follow. There are a few comments in the resource that people did to make it work for them. Maybe they will help you.Are you getting any error messages? Anything in the console? etc..
#12
02/09/2005 (3:36 am)
@Mathias... If you want to get to a certain point... Are you gonna walk in a spline or go straight there? Why would you want the bot to do it? Just wondering...
Torque Owner Bruno Grieco
1) Insert more path points so that it'll simulate your spline;
2) Maybe the robot could be mounted on a vehicle and then you should check the AIvehicle threads ( that's another problem all together ).
3) you could add some physics to the Player movement code, this way, not only the AIPlayer, but the Player would obey to some inertia ( This is the hardest approach IMHO ).