ODE Torque Stuff
by Gary "ChunkyKs" Briggs · in Torque Game Engine · 05/18/2005 (5:16 pm) · 89 replies
From my .plan just now: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7870
Here's some source:
icculus.org/~chunky/stuff/odescript/odescript-2005-05-18.tar.gz
Gary (-;
Here's some source:
icculus.org/~chunky/stuff/odescript/odescript-2005-05-18.tar.gz
Gary (-;
#62
But, i followed the notes, and could put the ODE working in my code.. ;D
11/25/2005 (7:37 am)
Hmm.. im nooob too... i cant make the ODE Demo works too.. heheBut, i followed the notes, and could put the ODE working in my code.. ;D
#63
Mapping string: SetupODEShape to index: 13
client Shape Body: 6 ID: 1387
client Shape Shape: 7 ID: 1388
client Shape World: -1 ID: 0
Looking through the console.log it appears that my world ID is -1 (or 0?).
Is this failing to initialise or this ok?
Also if I debug the processTick function (as below) some of the time my worldsim value is 0 and sometimes its 1357.
Is this normal behaviour or am I barking up the wrong tree here?
void ODEShape::processTick(const Move *move)
{
printf("worldsim %d \n", worldsim);
if(worldsim == 0 || contactgroup == 0 || odeobj == 0) {
return; // Can't do anything sensible without all three
}
11/25/2005 (8:07 am)
(No collision detection cont...)Mapping string: SetupODEShape to index: 13
client Shape Body: 6 ID: 1387
client Shape Shape: 7 ID: 1388
client Shape World: -1 ID: 0
Looking through the console.log it appears that my world ID is -1 (or 0?).
Is this failing to initialise or this ok?
Also if I debug the processTick function (as below) some of the time my worldsim value is 0 and sometimes its 1357.
Is this normal behaviour or am I barking up the wrong tree here?
void ODEShape::processTick(const Move *move)
{
printf("worldsim %d \n", worldsim);
if(worldsim == 0 || contactgroup == 0 || odeobj == 0) {
return; // Can't do anything sensible without all three
}
#64
And the simple answer is:
$pref::ODEPhysics::Server::Tolerance = 1;
(in the main.cs or defaults.cs depending on where your other ODEPhysics defines are!)
If this undefined (aka 0) then you get no collisions at all.
Now my rocks bounce.
If anyone knows of a 'good' value for this parameter please let me know - as far as I can tell simply no-zero is enough.
Hope this helps someone else out!
regards
Dan
11/25/2005 (10:19 am)
I have found a solution - I ran it in parallel with RigidBody and debugged the collision sets to found out why one bounced and the other didn't....And the simple answer is:
$pref::ODEPhysics::Server::Tolerance = 1;
(in the main.cs or defaults.cs depending on where your other ODEPhysics defines are!)
If this undefined (aka 0) then you get no collisions at all.
Now my rocks bounce.
If anyone knows of a 'good' value for this parameter please let me know - as far as I can tell simply no-zero is enough.
Hope this helps someone else out!
regards
Dan
#65
11/28/2005 (9:26 am)
So Gary how is it coming along?
#66
11/28/2005 (9:55 am)
Quite a long post, 6 months :P
#67
Let's fix up people's problems first
1) onCollision should be called for anything that generates a normal torque collision. You may have funky lists of what's colliding with what though. Check line 62 of odeshape.cc. See how it considers itself a staticshape? Ideally you'd add a new enumeration for it, just like RigidShape
That would probably fix a lot of collision weirdness. I did it like this because I want my stuff to magically drop in without requiring other code changes, so I slightly hijacked another shape's enumeration.
2) The world witchcraft is mostly a really ugly way of making sure that ODEShape plays nice with Torque's ghosting. On the whole, it should correct itself as and when every necessary part of the ODE simulation gets ghosted. Until then, you're running off server physics alone, and the objects aren't yet moving themselves, they'll move as if you had no clientside prediction at all. If you look down the console log, you'll probably find the world getting ghosted and more things picking it up later. As it happens, the world also sets an environment variable and the objects can grab that if they've not recieved a more definitive resource.
Overall, this isn't a great solution, but plays well with nodeterministic ghosting and can sensibly manage itself until everything gets ghosted to the client.
Worldsim changing value is probably it getting ghosted and unghosted. I think I have it set to always ghost, but I'm still not one with the Zen of Torque Networking, so I may be missing something.
3) Tolerance is something I jacked straight out of the RigidShape. It's somehing to do with what collides with what, and when. The honest truth is that I don't really understand it, still, and that's the same reason I've not replaced the rest of Torque's colision with OPCODE. If I don't understand it but so far it's worked well enough for me, I see no reason to change it.
If you search RigidShape for Tolerance, you'll find remarkably similar, and probably clearer, code than that in ODEShape.
4) Losing velocity when you hit walls. This is things like dampening, ERP, and CFM. It's explained in detail in The ODE UserGuide. Hit C to bring up the physics UI [assuming you have mine there; otherwise figure out your own way to mess with env.variables], and start tweaking. Everything gets modified on the fly.
Overall, I don't really understand, in depth, how Torque networks, or collides with stuff. I'm just borrowing ideas and code from RigidShape and ExampleBase and anything else that takes my fancy.
So, yeah. I, uh, still have a fair-to-middling World of Warcraft "problem", as it were. This hasn't dropped out of the ether, I am still looking at it. It's just... uh... yeah.
Gary (-;
PS If you want to do basic clientside stuff [and single player games where the client can be definitive], you only need to use ODEScript facilities; ODEShape is kind of a proof of concept exercise.
11/28/2005 (1:56 pm)
Woo.Let's fix up people's problems first
1) onCollision should be called for anything that generates a normal torque collision. You may have funky lists of what's colliding with what though. Check line 62 of odeshape.cc. See how it considers itself a staticshape? Ideally you'd add a new enumeration for it, just like RigidShape
That would probably fix a lot of collision weirdness. I did it like this because I want my stuff to magically drop in without requiring other code changes, so I slightly hijacked another shape's enumeration.
2) The world witchcraft is mostly a really ugly way of making sure that ODEShape plays nice with Torque's ghosting. On the whole, it should correct itself as and when every necessary part of the ODE simulation gets ghosted. Until then, you're running off server physics alone, and the objects aren't yet moving themselves, they'll move as if you had no clientside prediction at all. If you look down the console log, you'll probably find the world getting ghosted and more things picking it up later. As it happens, the world also sets an environment variable and the objects can grab that if they've not recieved a more definitive resource.
Overall, this isn't a great solution, but plays well with nodeterministic ghosting and can sensibly manage itself until everything gets ghosted to the client.
Worldsim changing value is probably it getting ghosted and unghosted. I think I have it set to always ghost, but I'm still not one with the Zen of Torque Networking, so I may be missing something.
3) Tolerance is something I jacked straight out of the RigidShape. It's somehing to do with what collides with what, and when. The honest truth is that I don't really understand it, still, and that's the same reason I've not replaced the rest of Torque's colision with OPCODE. If I don't understand it but so far it's worked well enough for me, I see no reason to change it.
If you search RigidShape for Tolerance, you'll find remarkably similar, and probably clearer, code than that in ODEShape.
4) Losing velocity when you hit walls. This is things like dampening, ERP, and CFM. It's explained in detail in The ODE UserGuide. Hit C to bring up the physics UI [assuming you have mine there; otherwise figure out your own way to mess with env.variables], and start tweaking. Everything gets modified on the fly.
Overall, I don't really understand, in depth, how Torque networks, or collides with stuff. I'm just borrowing ideas and code from RigidShape and ExampleBase and anything else that takes my fancy.
So, yeah. I, uh, still have a fair-to-middling World of Warcraft "problem", as it were. This hasn't dropped out of the ether, I am still looking at it. It's just... uh... yeah.
Gary (-;
PS If you want to do basic clientside stuff [and single player games where the client can be definitive], you only need to use ODEScript facilities; ODEShape is kind of a proof of concept exercise.
#69
12/09/2005 (1:17 pm)
Very cool, almost needed a drool cup thinking about how great this will be.
#70
01/19/2006 (6:46 am)
So how is it going Gary?
#71
It's okay to use one of the above links?
Sorry, this is probably an already-answered question but... phew!
The thread is getting quite big ;-)
Nice to see, anyway, someone pushing ODE -> Torque (-> in)
Bye, Berserk.
.
01/31/2006 (5:18 am)
I just read your TDN article. How to try your ODE-Script?It's okay to use one of the above links?
Sorry, this is probably an already-answered question but... phew!
The thread is getting quite big ;-)
Nice to see, anyway, someone pushing ODE -> Torque (-> in)
Bye, Berserk.
.
#72
Is there any new version?
Does it work with TGE1.4?
02/18/2006 (6:16 am)
Also very interested in this stuff.Is there any new version?
Does it work with TGE1.4?
#73
03/23/2006 (4:07 pm)
Its been a couple months now GAry. I thought I would check back to see how this project is coming along.
#74
03/30/2006 (10:44 am)
How's ODE comming along?
#75
04/13/2006 (5:26 pm)
*bump* Gary???
#76
04/17/2006 (10:56 pm)
I found this is a good resource.....
#77
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10258
04/18/2006 (1:35 am)
I found this is a great resourcehttp://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10258
#78
ODE seems to fit the bill nicely...
04/18/2006 (3:43 am)
@James: Thanks for the link... however, I believe there is definitely a need for a better physics solution with no strings attached; i.e. no special hardware needs or licensing fees. (At least until physics processors are mainstream.) I think this is especially true for indies with limited resources.ODE seems to fit the bill nicely...
#79
odeshape.cc
\Torque\SDK\engine\game\odeshape.cc(96) : error C2248: 'Convex::mObject' : cannot access protected member declared in class 'Convex'
../engine\collision\convex.h(161) : see declaration of 'Convex::mObject'
../engine\collision\convex.h(139) : see declaration of 'Convex'
\Torque\SDK\engine\game\odeshape.cc(97) : error C2248: 'ShapeBaseConvex::pShapeBase' : cannot access protected member declared in class 'ShapeBaseConvex'
../engine\game\shapeBase.h(76) : see declaration of 'ShapeBaseConvex::pShapeBase'
../engine\game\shapeBase.h(68) : see declaration of 'ShapeBaseConvex'
Any ideas what needs to be done? Then again I guess we never got the answer if this works in TGE 1.4?
Last question, are you still alive? No word from you on this since December just worrying I guess.
05/27/2006 (11:28 pm)
Gary I am finally at point in my project that I really wanted to try out your work but I have run into a couple problems on compile. odeshape.cc
\Torque\SDK\engine\game\odeshape.cc(96) : error C2248: 'Convex::mObject' : cannot access protected member declared in class 'Convex'
../engine\collision\convex.h(161) : see declaration of 'Convex::mObject'
../engine\collision\convex.h(139) : see declaration of 'Convex'
\Torque\SDK\engine\game\odeshape.cc(97) : error C2248: 'ShapeBaseConvex::pShapeBase' : cannot access protected member declared in class 'ShapeBaseConvex'
../engine\game\shapeBase.h(76) : see declaration of 'ShapeBaseConvex::pShapeBase'
../engine\game\shapeBase.h(68) : see declaration of 'ShapeBaseConvex'
Any ideas what needs to be done? Then again I guess we never got the answer if this works in TGE 1.4?
Last question, are you still alive? No word from you on this since December just worrying I guess.
#80
It does work fine in 1.4 as far I know.
05/28/2006 (11:40 am)
Make sure that the odeshape is declared as a 'friend' in the convex class, (see other friend declarations in the convex class to see what I mean). This isnt the best practice as far as clean OOP is concerned but it follows the convention TGE uses for accessing the data. See the ODEItem install instructions if you have more questions.It does work fine in 1.4 as far I know.
Torque Owner Dan Bowen
Are you using ODE enabled GameShapeBase types successfully in your code then?
I 'm not quite sure how to get the oderocks demo running, so, I thought I'd go straight for using it in my environment (following the notes at the top). Did you manage to run the demo even?