PhysicsShape applyForce function

This commit is contained in:
rextimmy 2017-01-05 10:38:05 +10:00
parent 8a39f5e7b6
commit 1559e7a3d3
7 changed files with 51 additions and 3 deletions

View file

@ -863,6 +863,12 @@ void PhysicsShape::applyTorque( const Point3F &torque )
mPhysicsRep->applyTorque( torque );
}
void PhysicsShape::applyForce( const Point3F &force )
{
if (mPhysicsRep && mPhysicsRep->isDynamic())
mPhysicsRep->applyForce( force );
}
void PhysicsShape::applyRadialImpulse( const Point3F &origin, F32 radius, F32 magnitude )
{
if ( !mPhysicsRep || !mPhysicsRep->isDynamic() )
@ -1193,4 +1199,12 @@ DefineEngineMethod( PhysicsShape, applyTorque, void, (Point3F torque), ,
"@note This value is ignored on physics shapes that are not dynamic. Wakes up the dynamic physics shape if it is sleeping.\n")
{
object->applyTorque( torque );
}
DefineEngineMethod(PhysicsShape, applyForce, void, (Point3F force), ,
"@brief Add a force to a dynamic physics shape.\n\n"
"@param force to apply to the dynamic physics shape\n"
"@note This value is ignored on physics shapes that are not dynamic. Wakes up the dynamic physics shape if it is sleeping.\n")
{
object->applyForce( force );
}