RigidShape into TGEA 1.0.3
by Andy Hawkins · in Torque Game Engine Advanced · 05/10/2008 (5:01 pm) · 4 replies
It seems there is no RigidShape class in TGEA 1.0.3 (and possibly fixed in TGEA 1.7)
As my game is built on TGEA 1.0.3 and I can't port it to TGEA 1.7 right now, how do I get the RigidShape (or other physics object) into TGEA 1.0.3 please?
BTW - It's okay for staff to answer this one too - don't be shy ;-)
As my game is built on TGEA 1.0.3 and I can't port it to TGEA 1.7 right now, how do I get the RigidShape (or other physics object) into TGEA 1.0.3 please?
BTW - It's okay for staff to answer this one too - don't be shy ;-)
#2
Rigid Shape Class
I then used this set of files and renamed the cc file to cpp
stash.miloonline.net/rigidShape_tgea.zip
and uncommented the line at the top to get it to compile for TSE
I fixed this error by removing the
I also ran into this and fixed it.
However when I loaded them into the game, the behaved correctly but they don't interact with each other - the research continues.
05/11/2008 (5:11 am)
Cool thanks - I did a quick search and located this resource.Rigid Shape Class
I then used this set of files and renamed the cc file to cpp
stash.miloonline.net/rigidShape_tgea.zip
and uncommented the line at the top to get it to compile for TSE
#define TSE 1
I fixed this error by removing the
,imagepart of the line...
..\engine\game\rigidShape.cpp(1630) : error C2660: 'ShapeBase::renderImage' : function does not take 2 arguments
I also ran into this and fixed it.
Quote:
I found the reason I was getting "Register object failed for object (null) of class RigidShape". It was because I had the same shape in the level as a Static Shape already. If I delete the equivalent static shape I can then add the Rigid Shape version with no problem. Apparently they don't like sharing *.dts files!
However when I loaded them into the game, the behaved correctly but they don't interact with each other - the research continues.
#3
05/11/2008 (8:51 am)
The problem I'm having with rigid bodies is they don't collide with each other even though there is a check in the code to do so (see below) and I can't shoot them, they also end up wiggling below the terrain and they wiggle a lot at rest... They also roll around then stand up right like bowling pins.in bool Rigid::resolveCollision(const Point3F& p, Point3F normal, Rigid* rigid)
- applyImpulse(r2,impulse);
+ // Fix: Impulse applied to wrong object
+ rigid->applyImpulse(r2,impulse);
@rigidShape.cc:
in namespace:
- static int sRestCount = 10; // Consecutive ticks before comming to rest
+ static int sRestCount = 5; // Consecutive ticks before coming to rest
void RigidShape::updatePos(F32 dt):
- if (k < sRestTol * Kg && ++restCount > sRestCount)
- mRigid.setAtRest();
+ if (k < sRestTol * Kg) {
+ if (++restCount > sRestCount)
+ mRigid.setAtRest();
+ } else
+ // FIX: restCount wasn't reset
+ restCount = 0;
+ }
in void RigidShape::updateForces(F32 /*dt*/):
- mRigid.atRest = false;
+ // Fix: Gravity doesn't wake up objects (eg: lying on the floor)
+ // mRigid.atRest = false;
in bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList):
- ns.resolveCollision(cList.collision[i].point,
- cList.collision[i].normal);
+ // Hack: wake up sleeping RigidShapes
+ // TODO: Interface to mRigid for all physically usable objects
+RigidShape *col = dynamic_cast<RigidShape*>(c.object);
+if (col != NULL && col->mRigid.atRest) {
+ ns.resolveCollision(cList.collision[i].point,
+ cList.collision[i].normal,
+ &col->mRigid);
+}else {
+ ns.resolveCollision(cList.collision[i].point,
+ cList.collision[i].normal);
+}
#4
05/11/2008 (4:25 pm)
Bump! I guess if someone knows how to fix these issues above please let me know. In the meantime I'm going to jump straight into implementing ODEScript and try that as a solution instead. I mainly need it to blow up buildings realistically in BRAVE.
Torque Owner Ronald J Nelson
Code Hammer Games