PhysicsShape applyTorque function

This commit is contained in:
rextimmy 2017-01-04 13:23:36 +10:00
parent f42c9bd9b7
commit 55e9af9786
7 changed files with 42 additions and 2 deletions

View file

@ -857,6 +857,12 @@ void PhysicsShape::applyImpulse( const Point3F &pos, const VectorF &vec )
mPhysicsRep->applyImpulse( pos, vec );
}
void PhysicsShape::applyTorque( const Point3F &torque )
{
if (mPhysicsRep && mPhysicsRep->isDynamic())
mPhysicsRep->applyTorque( torque );
}
void PhysicsShape::applyRadialImpulse( const Point3F &origin, F32 radius, F32 magnitude )
{
if ( !mPhysicsRep || !mPhysicsRep->isDynamic() )
@ -1179,4 +1185,12 @@ DefineEngineMethod( PhysicsShape, restore, void, (),,
"Has no effect if the shape is not destroyed.\n\n")
{
object->restore();
}
DefineEngineMethod( PhysicsShape, applyTorque, void, (Point3F torque), ,
"@brief Add a torque to a dynamic physics shape.\n\n"
"@param torque 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->applyTorque( torque );
}