Resolves merging-order conflicts for the vehicle physics PR, as well as correcting cmake not blacklisting the componentGroup files if TORQUE_EXPERIMENTAL_EC was flipped off.

This commit is contained in:
Areloch 2016-06-05 19:17:34 -05:00
commit 3a73344abb
36 changed files with 357 additions and 46 deletions

View file

@ -442,3 +442,25 @@ void BtBody::findContact(SceneObject **contactObject,
}
}
}
void BtBody::moveKinematicTo(const MatrixF &transform)
{
AssertFatal(mActor, "BtBody::moveKinematicTo - The actor is null!");
U32 bodyflags = mActor->getCollisionFlags();
const bool isKinematic = bodyflags & BF_KINEMATIC;
if (!isKinematic)
{
Con::errorf("BtBody::moveKinematicTo is only for kinematic bodies.");
return;
}
if (mCenterOfMass)
{
MatrixF xfm;
xfm.mul(transform, *mCenterOfMass);
mActor->setCenterOfMassTransform(btCast<btTransform>(xfm));
}
else
mActor->setCenterOfMassTransform(btCast<btTransform>(transform));
}

View file

@ -113,6 +113,8 @@ public:
virtual void applyImpulse( const Point3F &origin, const Point3F &force );
virtual void findContact(SceneObject **contactObject, VectorF *contactNormal, Vector<SceneObject*> *outOverlapObjects) const;
virtual void moveKinematicTo(const MatrixF &xfm);
};
#endif // _T3D_PHYSICS_BTBODY_H_

View file

@ -71,6 +71,7 @@ void BtPlayer::init( const char *type,
mObject = obj;
mWorld = (BtWorld*)world;
mSlopeAngle = runSurfaceCos;
mStepHeight = stepHeight;
//if ( dStricmp( type, "Capsule" ) == 0 )
@ -102,6 +103,17 @@ Point3F BtPlayer::move( const VectorF &disp, CollisionList &outCol )
{
AssertFatal( mGhostObject, "BtPlayer::move - The controller is null!" );
if (!mWorld->isEnabled())
{
btTransform currentTrans = mGhostObject->getWorldTransform();
btVector3 currentPos = currentTrans.getOrigin();
Point3F returnPos = btCast<Point3F>(currentPos);
returnPos.z -= mOriginOffset;
return returnPos;
}
// First recover from any penetrations from the previous tick.
U32 numPenetrationLoops = 0;
bool touchingContact = false;
@ -305,16 +317,9 @@ bool BtPlayer::_sweep( btVector3 *inOutCurrPos, const btVector3 &disp, Collision
col.normal = btCast<Point3F>( callback.m_hitNormalWorld );
col.object = PhysicsUserData::getObject( callback.m_hitCollisionObject->getUserPointer() );
if (disp.z() < 0.0f)
{
// We're sweeping down as part of the stepping routine. In this
// case we want to have the collision normal only point in the opposite direction.
// i.e. up If we include the sideways part of the normal then the Player class
// velocity calculations using this normal will affect the player's forwards
// momentum. This is especially noticable on stairs as the rounded bottom of
// the capsule slides up the corner of a stair.
col.normal.set(0.0f, 0.0f, 1.0f);
}
F32 vd = col.normal.z;
if (vd < mSlopeAngle)
return false;
}
return true;

View file

@ -57,6 +57,10 @@ protected:
///
F32 mOriginOffset;
///
F32 mSlopeAngle;
///
///
F32 mStepHeight;
///