Skip to content

Commit

Permalink
server: novodex: refactored SetLinearMomentum method
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Sep 9, 2023
1 parent 8fb7d6a commit 1ec83ef
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions server/novodex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1800,15 +1800,12 @@ void CPhysicNovodex :: RotateObject( CBaseEntity *pEntity, const Vector &finalAn

void CPhysicNovodex :: SetLinearMomentum( CBaseEntity *pEntity, const Vector &velocity )
{
PxActor *pActor = ActorFromEntity( pEntity );
if( !pActor )
PxActor *pActor = ActorFromEntity(pEntity);
if (!pActor)
return;

// TODO modern PhysX SDK doesn't have method setLinearMomentum for dynamic bodies
// so maybe we just can replace it with setLinearVelocity(velocity * mass)?
// i'm not sure in this since so weak at physics theory and terminology
PxRigidDynamic *pRigidDynamic = pActor->is<PxRigidDynamic>();
pRigidDynamic->setLinearVelocity( velocity * pRigidDynamic->getMass() );
pRigidDynamic->setForceAndTorque(velocity, PxVec3(0.f), PxForceMode::eIMPULSE);
}

void CPhysicNovodex :: AddImpulse( CBaseEntity *pEntity, const Vector &impulse, const Vector &position, float factor )
Expand Down

0 comments on commit 1ec83ef

Please sign in to comment.