Removed crash, when fbx has no material. Added rotation + offset to physx boxes

This commit is contained in:
2025-07-18 16:55:31 +02:00
parent 602dd870df
commit 1b339f087b
4 changed files with 59 additions and 33 deletions

View File

@@ -172,7 +172,6 @@ add_physx_capsule :: (entity: *Entity, half_height: float, radius: float) -> Phy
shape := PhysX.PxPhysics_createShape(physics, *geo, material, false, PHYSX_DEFAULT_SHAPE_FLAGS);
PhysX.PxRigidActor_attachShape(actor, shape);
PhysX.PxRigidBodyExt_updateMassAndInertia(actor, 0.1, null, false);
PhysX.PxScene_addActor(entity.scene.physx_scene.scene, actor, null);
@@ -188,9 +187,10 @@ add_physx_capsule :: (entity: *Entity, half_height: float, radius: float) -> Phy
return entity.physx_handle;
}
add_physx_box :: (entity: *Entity, half_extent: Vector3) -> PhysX_Handle {
add_physx_box :: (entity: *Entity, half_extent: Vector3, offset: Vector3 = .{}) -> PhysX_Handle {
shape := PhysX.PxPhysics_createShape(physics, PhysX.PxBoxGeometry_new(half_extent), material, false, PHYSX_DEFAULT_SHAPE_FLAGS);
t := PhysX.PxTransform_new(*entity.transform.position);
pos := entity.transform.position + offset;
t := PhysX.PxTransform_new(*pos, *entity.transform.orientation);
body := PhysX.PxPhysics_createRigidStatic(physics, *t);
PhysX.PxRigidActor_attachShape(body, shape);