Skip to content

Commit

Permalink
server: novodex: implemented rotation locking for kinematic bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Sep 8, 2023
1 parent 4d8d57a commit 8fb7d6a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions server/novodex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,6 @@ void *CPhysicNovodex :: CreateKinematicBodyFromEntity( CBaseEntity *pObject )
if (!pCollision)
return NULL;

//if( !UTIL_CanRotate( pObject ))
// BodyDesc.flags |= NX_BF_FROZEN_ROT; // entity missed origin-brush

PxRigidDynamic *pActor = m_pPhysics->createRigidDynamic(PxTransform(PxIdentity));
PxShape *pShape = PxRigidActorExt::createExclusiveShape(*pActor, PxTriangleMeshGeometry(pCollision), *m_pDefaultMaterial);

Expand All @@ -1146,6 +1143,15 @@ void *CPhysicNovodex :: CreateKinematicBodyFromEntity( CBaseEntity *pObject )
return NULL;
}

if (!UTIL_CanRotate(pObject))
{
// entity missed origin-brush
pActor->setRigidDynamicLockFlags(
PxRigidDynamicLockFlag::eLOCK_ANGULAR_X |
PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y |
PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z);
}

float mat[16];
matrix4x4( pObject->GetAbsOrigin(), pObject->GetAbsAngles(), 1.0f ).CopyToArray( mat );

Expand Down

0 comments on commit 8fb7d6a

Please sign in to comment.