Plan for Gary "ChunkyKs" Briggs
by Gary "ChunkyKs" Briggs · 05/20/2005 (9:46 am) · 7 comments
Image time:
What is it? Well, the rope thing is a chain of ODE bodies, tethered at the right end. 100 or so of them. Gravity points down.
The spaceship and it's T2D collision code is copied verbatim from the spacescrollerdemo. That's 100% T2D's collision library doing all the hard work, and that's the two colliding.
Want ODE bodies and T2D Physics bodies interacting at the same time on the same screen? Knock yourself out; it's trivial!
Six lines of code. What's really neat is that this is using no collision code except T2D's; if you're familiar with ODE & dGeom, be aware that I've explicitly NOT implemented dGeom here. Torque is more than capable of doing it's own collision detection, I see no reason to duplicate effort on that front.
Well, that was fun. Only thing left to do before I release a real resource on this is to get the depth of the collision, but that's been causing me some problems.
This still builds & runs with TGE, also. After the depth issue, next thing on my list is a new ODEItem-type-thing in TGE. I'm pretty sure that this will be pretty easy. We'll have to see.
Gary (-;
UPDATE: Demos are available here: Linux Windows
What is it? Well, the rope thing is a chain of ODE bodies, tethered at the right end. 100 or so of them. Gravity points down.
The spaceship and it's T2D collision code is copied verbatim from the spacescrollerdemo. That's 100% T2D's collision library doing all the hard work, and that's the two colliding.
Want ODE bodies and T2D Physics bodies interacting at the same time on the same screen? Knock yourself out; it's trivial!
function that-T2D-collision-thing-that-Ive-hidden-but-trust-me-it's-the-normal-one {
%c = new tdContact();
%c.SetNormal(getWord(%normalvec,0), getWord(%normalvec,1), 0);
%c.SetPos(getWord(%contactpoint,0), getWord(%contactpoint,1), 0);
%j = new tdJoint();
%j.CreateContact($odeworld, $odecollisionjg, %c);
%j.Attach(%srcObj.odeobj, %dstObj.odeobj);
} Six lines of code. What's really neat is that this is using no collision code except T2D's; if you're familiar with ODE & dGeom, be aware that I've explicitly NOT implemented dGeom here. Torque is more than capable of doing it's own collision detection, I see no reason to duplicate effort on that front.
Well, that was fun. Only thing left to do before I release a real resource on this is to get the depth of the collision, but that's been causing me some problems.
This still builds & runs with TGE, also. After the depth issue, next thing on my list is a new ODEItem-type-thing in TGE. I'm pretty sure that this will be pretty easy. We'll have to see.
Gary (-;
UPDATE: Demos are available here: Linux Windows
About the author
#2
EDIT: I think Joshua has a good concern, might want to cut all T2D stuff out of that code, maybe just use psuedo code
05/20/2005 (10:20 am)
great stuff!EDIT: I think Joshua has a good concern, might want to cut all T2D stuff out of that code, maybe just use psuedo code
#3
05/20/2005 (10:49 am)
(is it OK to post that code here?)
#4
@Joshua: Well, I'd thought that the name of the callback wouldn't be a problem, but now I think about it, good point.
I've changed the names of the function, and it's apparent parameters.
05/20/2005 (11:46 am)
@Drew, Matt: Thank-you!@Joshua: Well, I'd thought that the name of the callback wouldn't be a problem, but now I think about it, good point.
I've changed the names of the function, and it's apparent parameters.
#5
And BTW this is very cool! Snappy demo that Mr. Langley is working on may be utilizing something similar to this, so it's cool to see.
05/20/2005 (3:26 pm)
I wasn't sure so I thought I'd mention it :) You can always post full code in the T2D private forums, then simply link to your new forum post from your blog entry.And BTW this is very cool! Snappy demo that Mr. Langley is working on may be utilizing something similar to this, so it's cool to see.
#6
Gary (-;
05/20/2005 (4:50 pm)
Yeah, I thought of Snappy when I first got this working. Well, you'er more than welcome to use it if you so choose!Gary (-;
#7
05/20/2005 (10:26 pm)
Nifty...
Torque 3D Owner Drew Parker