Added transform -> PhysX position presync

This commit is contained in:
2025-08-03 00:46:37 +02:00
parent 8e2bc651b9
commit 17c3469602

View File

@@ -168,6 +168,10 @@ pre_physx_sync :: (game_scene: *Scene) {
physx_actor := parray_get(*game_scene.physx_scene.actors, it.physics.physx_handle);
if physx_actor.type == {
case .DYNAMIC; {
// @Incomplete: Might wanna do this differently or at least not every frame?
// We could potentially cache the last saved position and not update the pose, if PhysX is synced up
pose := PhysX.PxTransform_new(*it.transform.position);
PhysX.PxRigidActor_setGlobalPose(physx_actor.dynamic, *pose, true);
PhysX.PxRigidDynamic_setLinearVelocity(physx_actor.dynamic, *it.physics.velocity, true);
}
}