From 17c34696020425a83cc80f467e06539d7a9ac191 Mon Sep 17 00:00:00 2001 From: Daniel Bross Date: Sun, 3 Aug 2025 00:46:37 +0200 Subject: [PATCH] Added transform -> PhysX position presync --- physics/physx.jai | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/physics/physx.jai b/physics/physx.jai index c5f9b31..0835da1 100644 --- a/physics/physx.jai +++ b/physics/physx.jai @@ -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); } }