Added updateMassAndInertia call
This commit is contained in:
@@ -140,7 +140,7 @@ post_physx_sync :: (game_scene: *Scene) {
|
||||
|
||||
transform := PhysX.PxRigidActor_getGlobalPose(physx_actor.dynamic);
|
||||
|
||||
if physx_actor.sync_rotation_from_physx {
|
||||
if physx_actor.sync_rotation_from_physx || it.physics.type == .SPHERE {
|
||||
set_position_rotation(it, transform.p, transform.q);
|
||||
} else {
|
||||
set_position(it, transform.p);
|
||||
@@ -175,7 +175,7 @@ create_physx_actor :: (e: *Entity) {
|
||||
|
||||
if e.physics.lock & .ANGULAR_X {
|
||||
PhysX.PxRigidDynamic_setRigidDynamicLockFlag(dynamic, xx PhysX.PxRigidDynamicLockFlags.LockAngularX, true);
|
||||
}
|
||||
}
|
||||
if e.physics.lock & .ANGULAR_Y {
|
||||
PhysX.PxRigidDynamic_setRigidDynamicLockFlag(dynamic, xx PhysX.PxRigidDynamicLockFlags.LockAngularY, true);
|
||||
}
|
||||
@@ -207,6 +207,10 @@ create_physx_actor :: (e: *Entity) {
|
||||
|
||||
PhysX.PxRigidActor_attachShape(actor, shape);
|
||||
|
||||
if e.physics.dynamic {
|
||||
PhysX.PxRigidBodyExt_updateMassAndInertia(cast(*PhysX.PxRigidBody)actor, 1000.0, null, false);
|
||||
}
|
||||
|
||||
PhysX.PxScene_addActor(e.scene.physx_scene.scene, actor, null);
|
||||
|
||||
PhysX.PxShape_release(shape);
|
||||
|
||||
Reference in New Issue
Block a user