T3D 1.1 Beta 3 - Collision bug with PhysicalZones (+fix)
by Ivan Mandzhukov · in Torque 3D Professional · 12/28/2010 (4:19 pm) · 1 replies
Hi,
today I was dealing with zones and found problems when working with small accelerations.
The PhysicalZones apply several forces,some of them early than the rest.
Forces like mGravityMod and mAppliedForce are applied in ShapeBase within an intersection check.
Ok,this is fine.
But: mVelocityMod is applied in player::_move()
Good so far.
Actually both checks use different boxes (with a really small difference),therefore if you work with small accelerations, this difference is really bad for you,because some forces will trigger,some will not.
Currently a simple solution is to not use the shapeBase logic (updateContainer() and physicalZoneFind()).
I moved mAppliedForce in _move(),now the correct code looks like this:
Finally remove the force from updateMove()
today I was dealing with zones and found problems when working with small accelerations.
The PhysicalZones apply several forces,some of them early than the rest.
Forces like mGravityMod and mAppliedForce are applied in ShapeBase within an intersection check.
Ok,this is fine.
But: mVelocityMod is applied in player::_move()
Good so far.
Actually both checks use different boxes (with a really small difference),therefore if you work with small accelerations, this difference is really bad for you,because some forces will trigger,some will not.
Currently a simple solution is to not use the shapeBase logic (updateContainer() and physicalZoneFind()).
I moved mAppliedForce in _move(),now the correct code looks like this:
for (U32 j = 0; j < physZoneCollisionList.getCount(); j++)
{
AssertFatal(dynamic_cast<PhysicalZone*>(physZoneCollisionList[j].object), "Bad phys zone!");
const PhysicalZone* pZone = (PhysicalZone*)physZoneCollisionList[j].object;
if (pZone->isActive())
{
mVelocity *= pZone->getVelocityMod();
mVelocity += (mAppliedForce / getMass()) * TickSec;
}
}Finally remove the force from updateMove()
// acc += (mAppliedForce / getMass()) * TickSec;
Torque 3D Owner Ray Batts
Sickhead Games