Added updateMassAndInertia call

This commit is contained in:
2025-07-22 11:37:22 +02:00
parent a5bde6194a
commit 487175f126
2 changed files with 7 additions and 3 deletions

View File

@@ -232,7 +232,7 @@ update_transform_gizmo :: (ray: Ray, mouse_position: Vector2) -> bool {
r1 : Ray;
r1.origin = selected_entity.transform.position;
r1.direction = axis_vec;//rotate(axis_vec, engine.editor.transform_gizmo.transform.orientation);
r1.direction = axis_vec;
r2 := normalized_screen_to_ray(*engine.editor.camera, mouse_position);

View File

@@ -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);