Dynamic Shape, path code, trigger & animation
by Frank Bignone · in Torque Game Engine · 09/08/2002 (10:30 am) · 12 replies
I will post a resource concerning :
- path code for shape : shape that will follow a path
- one way or cyclic path
- linear or spline path
- trigger to start/stop movement on a path
- trigger to change the path of a shape
- trigger to start/stop anim of a shape
For that purpose, i have put a new class named DynamicShape that is derived from ShapeBase class and support all path features. I have also modified the pathManager and Path class a little bit.
In the following zip file, you will find all the interesting stuff to unzip in your torque dir. There is the .cc file for the engine and some utility script funcs in the example dir. I have also modified the waterworld mission, so you can test the code directly (with the trigger working also).
This code is used in dop for thinks like : train, rollercoaster, ...
Here is the zip file : www.darkhand.dnsalias.com/files/code/PathCode.zip
To understand how it works, look at the waterworld mission file (end of the file), it is where i have added the dynamic shape + trigger callback.
I do not have time now to put more info, i will do it later.
So please, can someone test it before i send a resource (read the readme.txt file).
Thanks
- path code for shape : shape that will follow a path
- one way or cyclic path
- linear or spline path
- trigger to start/stop movement on a path
- trigger to change the path of a shape
- trigger to start/stop anim of a shape
For that purpose, i have put a new class named DynamicShape that is derived from ShapeBase class and support all path features. I have also modified the pathManager and Path class a little bit.
In the following zip file, you will find all the interesting stuff to unzip in your torque dir. There is the .cc file for the engine and some utility script funcs in the example dir. I have also modified the waterworld mission, so you can test the code directly (with the trigger working also).
This code is used in dop for thinks like : train, rollercoaster, ...
Here is the zip file : www.darkhand.dnsalias.com/files/code/PathCode.zip
To understand how it works, look at the waterworld mission file (end of the file), it is where i have added the dynamic shape + trigger callback.
I do not have time now to put more info, i will do it later.
So please, can someone test it before i send a resource (read the readme.txt file).
Thanks
About the author
Real programmers don't waste time recompiling; they patch the binary files... ... Real programmers don't waste time patching binary files; they patch memory.
#2
09/08/2002 (2:28 pm)
i got this Compiling... simPath.cc d:\after school cartoons\torque\engine\sim\simpath.cc(268) : error C2065: 'addGroup' : undeclared identifier d:\after school cartoons\torque\engine\sim\simpath.cc(271) : error C2065: 'endGroup' : undeclared identifier Error executing cl.exe. simPath.obj - 2 error(s), 0 warning(s)I commented out the lines and it compiled
#3
simply remove/comment these lines... or update to the HEAD version...
09/08/2002 (2:31 pm)
Then you don't have the latest HEAD with Melv's gui object grouping...simply remove/comment these lines... or update to the HEAD version...
#4
- 0 : one way path (from A to B) with linear interpolation
- 1 : cyclic path (A to B to A) with linear interpolation
- 2 & 3 : like 0 & 1 with spline interpolation
09/08/2002 (2:51 pm)
To add more info : the path type means the following :- 0 : one way path (from A to B) with linear interpolation
- 1 : cyclic path (A to B to A) with linear interpolation
- 2 & 3 : like 0 & 1 with spline interpolation
#5
09/08/2002 (2:51 pm)
compiled and got when loaded levelconsoleobject.cc @ 64 Couldn't find class rep for dynamic class: DynamicShapeData consoleobject.cc @ 64 Couldn't find class rep for dynamic class: DynamicShapeI'll update the code and retry
#6
09/08/2002 (2:54 pm)
Add the file DynShape.cc to your makefile and recompile torque. it is written in the readme file :)
#7
09/08/2002 (3:14 pm)
I know how to add to the project but Makefile, I m not sure, could you explain?
#8
@Frank: Great stuff dude! Gonna try this right away! :D
09/08/2002 (5:03 pm)
*rolls eyes* Anthony.. MakeFile... project... that's what he meant.@Frank: Great stuff dude! Gonna try this right away! :D
#9
09/09/2002 (4:02 am)
Doh 2 jobs and looking at code = many bugs, well now I'm updated, with this new PATH code, And I was wondering could splines be drawn some how? or imported?. . . Any way it works very nicely!!
#10
09/16/2002 (2:31 am)
Ok, i have added a resource with this code and some help too : www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3242
#11
I have the same problem that Stefan did; I can modify a players's sCollisionMoveMask to include ShapeBaseObjectType, but the player can still walk right through a scripted object =/
Syncro doesn't help, and it's frustrating me because fundamentally it feels like it *should* work, I mean I used the default code & model and the "mTypeMask |= ShapeBaseObjectType" is there clear as day in the dynamic object code. It taunts me...
Was there any simple solution? Thanks regardless!
09/06/2003 (7:18 pm)
Hi! In Resource Comments, there was a question about player collisions with Dynamic Shape pathing, but I can't find the resolution anywhere...I have the same problem that Stefan did; I can modify a players's sCollisionMoveMask to include ShapeBaseObjectType, but the player can still walk right through a scripted object =/
Syncro doesn't help, and it's frustrating me because fundamentally it feels like it *should* work, I mean I used the default code & model and the "mTypeMask |= ShapeBaseObjectType" is there clear as day in the dynamic object code. It taunts me...
Was there any simple solution? Thanks regardless!
#12
Stealing those from player.cc, fixing the player collision mask to include ShapeBaseObjectType, and taking synchro = 1 to smooth the collisions finally worked.
And ideally implement that in a new class, because right now crossbows stop me dead in my tracks =)
09/08/2003 (12:13 am)
I finally solved my prob...a default DynShape doesn't include a buildConvex or buildPolyList function so collisions don't register.Stealing those from player.cc, fixing the player collision mask to include ShapeBaseObjectType, and taking synchro = 1 to smooth the collisions finally worked.
And ideally implement that in a new class, because right now crossbows stop me dead in my tracks =)
Associate Stefan Beffy Moises
That's an amazing add-on to the engine, there are various different areas where this could be used...
e.g. animating the paths of very simple NPCs (guards wandering around, peasants walking by, etc.), trains, rollercoasters, streetcars, etc. etc.!
Especially the triggering of animations is very handy...
you could change from walk to run or to jump, etc. via triggers... awesome! Thanks a lot for this!!