Request: Simple move Object from way point to way point
by AllynMcelrath · in Torque Game Engine · 12/19/2005 (5:42 pm) · 8 replies
Is there a simple ,bare bones, resorce for making an animated object move in a path using waypoints?
I have looked at AIguard and AIpotroler. I think they are a little overkill, and they require compiling it seems.
But what i have is a simple butterfly, all i need it to do is move from one waypoint marker to the next in order, while playing an animation(s). Im hopeing there is some simple exampile that i can build on for other things, but i would like to start very simple, and all in Script (im not a coder, and am learning script).
Thank you
Allyn.
I have looked at AIguard and AIpotroler. I think they are a little overkill, and they require compiling it seems.
But what i have is a simple butterfly, all i need it to do is move from one waypoint marker to the next in order, while playing an animation(s). Im hopeing there is some simple exampile that i can build on for other things, but i would like to start very simple, and all in Script (im not a coder, and am learning script).
Thank you
Allyn.
#2
I cant compile so, i was hoping that all i realy needed was the correct script.
12/20/2005 (8:43 am)
Im using 1.4 , isnt all this already in the engine?I cant compile so, i was hoping that all i realy needed was the correct script.
#3
Im going to just defuilt to making the animation do the movement, i just realy wanted to use waypoints.
12/22/2005 (9:58 am)
So im assuming that there is no such resorce...only thing avabile is scripts for guards that attack?Im going to just defuilt to making the animation do the movement, i just realy wanted to use waypoints.
#4
Do you get an error?
What messages do you get when trying to compile Pathshape for 1.4?
I've recently implemented the Pathshape, admidatly, I'm not using 1.4 but I'm not far off... I didn't get any errors at all when compiling. I might be able to help if you post your errors.
If you can get it to compile, it works really well.
TBH, I don't know why the pathShape isn't already in the engine, seems like such a powerful object and from the looks of things, it would do exactly what you want it to.
12/22/2005 (10:09 am)
You can't compile? how come?Do you get an error?
What messages do you get when trying to compile Pathshape for 1.4?
I've recently implemented the Pathshape, admidatly, I'm not using 1.4 but I'm not far off... I didn't get any errors at all when compiling. I might be able to help if you post your errors.
If you can get it to compile, it works really well.
TBH, I don't know why the pathShape isn't already in the engine, seems like such a powerful object and from the looks of things, it would do exactly what you want it to.
#5
I was requesting just a simple snipit of code that would move an object from waypoint to waypoint while playing an animation... Any and all refrences i can find have to many uneed features (such as atacking and what not) for me to identify what should be a simple script (in my mind that is).
I am an artiest, not a coder, a am trying to do what i can before seeking a programer (lots of reasions as to why).
In most cases, simple waypointing is in the hands of the artiest or world-builder... This should be a simple function of the world editor (IMHO)..but its not, i should just be able to set out some waypoints..group them..arange the leanier path, and asign any object to follow that path with animation lists.
Eh... anyway, to answer your question, I dont know the first thing about compilling the engine.
12/22/2005 (1:00 pm)
What i mean by i cant compile is, im not a programer.. I didnt think somthing like a waypointing system would require Recompilling the entire engine, it seems like it would be somthing that scripts would beable to handle, Its just not somthing i am able to script yet. I was requesting just a simple snipit of code that would move an object from waypoint to waypoint while playing an animation... Any and all refrences i can find have to many uneed features (such as atacking and what not) for me to identify what should be a simple script (in my mind that is).
I am an artiest, not a coder, a am trying to do what i can before seeking a programer (lots of reasions as to why).
In most cases, simple waypointing is in the hands of the artiest or world-builder... This should be a simple function of the world editor (IMHO)..but its not, i should just be able to set out some waypoints..group them..arange the leanier path, and asign any object to follow that path with animation lists.
Eh... anyway, to answer your question, I dont know the first thing about compilling the engine.
#6
The waypoint system is designed out of the box for the Path Camera and the AI Bot. To make a shape move along a path requires a mod. But pathed objects (players) are fully supported.
I understand your situation however, you're an artist and you don't want to have to worry about hacking the C++ and at some point in the future, you may not have to. But for the pathed shape solution as it stands, you need a rebuild of the engine with this feature built in.
According to your profile, you're a SDK owner so there shouldn't be a problem building in this resource.. it is simplicity itself (depending on the tools you have and your definition of simplicity)
But if you don't have the tools or don't want to have to worry about getting everything set up for a built environment, I'm sure someone could build you a version with the path shape code in.
Sorry if this isn't the news you wanted. But please try not to be too dissapointed by Torque's apparent lack of out of the box features.. The attiture of You have the code, you can do anything is a good one.. it makes Torque very very powerful as it's infinitely extendable.
12/22/2005 (1:09 pm)
Well, The waypoint system is designed out of the box for the Path Camera and the AI Bot. To make a shape move along a path requires a mod. But pathed objects (players) are fully supported.
I understand your situation however, you're an artist and you don't want to have to worry about hacking the C++ and at some point in the future, you may not have to. But for the pathed shape solution as it stands, you need a rebuild of the engine with this feature built in.
According to your profile, you're a SDK owner so there shouldn't be a problem building in this resource.. it is simplicity itself (depending on the tools you have and your definition of simplicity)
But if you don't have the tools or don't want to have to worry about getting everything set up for a built environment, I'm sure someone could build you a version with the path shape code in.
Sorry if this isn't the news you wanted. But please try not to be too dissapointed by Torque's apparent lack of out of the box features.. The attiture of You have the code, you can do anything is a good one.. it makes Torque very very powerful as it's infinitely extendable.
#7
look at the file "example/starter.fps/server/scripts/aiPlayer.cs" In there is some already existing AI functionality, including a simple pathfinding set of functions. As you may notice in the default Stronghold mission Kork spawns and runs around a path... you can accomplish this by creating a path through the mission editor (Its a simply process, create a Path object, then within the Path object create path markers, thats it :)... then to spawn a bot on that path use the command used in function AIManager::spawn(%this) which is in aiPlayer.cs....
this is how "Kork" is spawned on the path and told to follow it
Hope this helps, look in aiPlayer.cs to see a lot more functions to help.
12/22/2005 (1:55 pm)
Allyn, what you want is already in Torque Scripts... let me point you in the right direction :)look at the file "example/starter.fps/server/scripts/aiPlayer.cs" In there is some already existing AI functionality, including a simple pathfinding set of functions. As you may notice in the default Stronghold mission Kork spawns and runs around a path... you can accomplish this by creating a path through the mission editor (Its a simply process, create a Path object, then within the Path object create path markers, thats it :)... then to spawn a bot on that path use the command used in function AIManager::spawn(%this) which is in aiPlayer.cs....
this is how "Kork" is spawned on the path and told to follow it
%player = AIPlayer::spawnOnPath("Kork","MissionGroup/Paths/Path1");
%player.followPath("MissionGroup/Paths/Path1",-1);Hope this helps, look in aiPlayer.cs to see a lot more functions to help.
#8
I did notice the aiPlayer.cs, and even tryed to just isolate the part that makes him move around.. I couldnt make headno hair of it, and with the game just crashing with no error log (didnt make one), im at a loss on that one.
But somthing i did notice is that (as i understand it) aiPlayer.cs (for lack of a better name) only works with the player avatar..sadley..This butterfly is just some enviromential fluff. And i dont want all my players to be butterlfys, or all my butterflys to be players =).
Im guessing what im really looking for is this.
One data block that defines the DTS file to use
Then somthing that makes it asign to the path, and play some animations when it reaches waypoints..or mabye some kind of timed triggers
Im sure im missing alot of things.. And i am making a valid atempt to learn Torques scripting, i just prefer to start simple..
So, if anyone can understand what my "code" is trying to do, please..i learn best from exampile.
=) thank you.
And thats to all that have atempted to help me.
PS. No thats not real code, lol, its my atempt to explane what im trying to do in some form of code like way... Im trying.
12/23/2005 (7:50 pm)
Matt - I did try to add the aiPlayer.cs file to my "moded" version of the "tortial.bace".. The game exe'd the .cs, and instantly crashed =(I did notice the aiPlayer.cs, and even tryed to just isolate the part that makes him move around.. I couldnt make headno hair of it, and with the game just crashing with no error log (didnt make one), im at a loss on that one.
But somthing i did notice is that (as i understand it) aiPlayer.cs (for lack of a better name) only works with the player avatar..sadley..This butterfly is just some enviromential fluff. And i dont want all my players to be butterlfys, or all my butterflys to be players =).
Im guessing what im really looking for is this.
One data block that defines the DTS file to use
Datablock (Butterfly1)
{
Shapefile = "./data/ETC.../Butterfly.dts";
Some other things that im not sure what they are = "stuff";
}Then somthing that makes it asign to the path, and play some animations when it reaches waypoints..or mabye some kind of timed triggers
Datablock (ButterMover1)
{
Shape = "butterfly1";
Path = "path1";
Spawmthething = "at game start" // <-- LOL! my "l33t" programing skills lol
Get current Waypoint ="keep that number in a $ (That local varable isnt it?) "
If Current waypoint is less than than "1"
Move to waypoint = "1",setcurrentWPto "",Play Animation thread "flapper";
If Current waypoint is less than "1" and isnt "0"
Move to waypoint = "2"setcurrentWPto "",Play Animation thread "flapper";
If Current waypoint is less than "2" and isnt "1"
Move to waypoint = "3"setcurrentWPto "",Play Animation thread "flapper";
ETC....
}Im sure im missing alot of things.. And i am making a valid atempt to learn Torques scripting, i just prefer to start simple..
So, if anyone can understand what my "code" is trying to do, please..i learn best from exampile.
=) thank you.
And thats to all that have atempted to help me.
PS. No thats not real code, lol, its my atempt to explane what im trying to do in some form of code like way... Im trying.
Torque Owner Sam3d
Then, playing the animation and following the path are accomplished the usual way.