Might have fixed PhysX triangle meshes
This commit is contained in:
@@ -346,12 +346,11 @@ create_physx_actor :: (e: *Entity) {
|
||||
matrix := inv_matrix * render_data.transform.world_matrix;
|
||||
|
||||
if node.meshes.count > 0 {
|
||||
print("NUM MESHES %\n", node.meshes.count);
|
||||
for m, mi: node.meshes {
|
||||
index_start : u32 = xx indices.count;
|
||||
mesh := parray_get(*engine.renderer.meshes, m);
|
||||
for v: mesh.positions {
|
||||
array_add(*points, v);//transform_position(v, matrix));
|
||||
array_add(*points, transform_position(v, matrix));
|
||||
}
|
||||
|
||||
for i: mesh.indices {
|
||||
@@ -370,53 +369,53 @@ create_physx_actor :: (e: *Entity) {
|
||||
mesh_desc.triangles.data = indices.data;
|
||||
|
||||
//if !PhysX.PxValidateTriangleMesh(*cooking_params, *mesh_desc) {
|
||||
// assert(false);
|
||||
//}
|
||||
// assert(false);
|
||||
//}
|
||||
|
||||
callback := PhysX.PxGetStandaloneInsertionCallback();
|
||||
mesh := PhysX.PxCreateTriangleMesh(*cooking_params, *mesh_desc, callback, null);
|
||||
scale := PhysX.PxMeshScale_new(*e.transform.scale);
|
||||
geo = PhysX.PxTriangleMeshGeometry_new(mesh, *scale, 0);
|
||||
}
|
||||
callback := PhysX.PxGetStandaloneInsertionCallback();
|
||||
mesh := PhysX.PxCreateTriangleMesh(*cooking_params, *mesh_desc, callback, null);
|
||||
scale := PhysX.PxMeshScale_new(*e.transform.scale);
|
||||
geo = PhysX.PxTriangleMeshGeometry_new(mesh, *scale, 0);
|
||||
}
|
||||
}
|
||||
|
||||
shape := PhysX.PxPhysics_createShape(physics, geo, material, false, ifx e.physics.trigger then PHYSX_DEFAULT_TRIGGER_SHAPE_FLAGS else PHYSX_DEFAULT_SIMULATION_SHAPE_FLAGS);
|
||||
|
||||
// Setup layers
|
||||
filter_data := PhysX.PxFilterData_new();
|
||||
filter_data.word0 = 1;
|
||||
filter_data.word1 = 1;
|
||||
filter_data.word2 = 1;
|
||||
filter_data.word3 = 1;
|
||||
|
||||
//PhysX.PxShape_setSimulationFilterData(shape, *filter_data);
|
||||
//PhysX.PxShape_setQueryFilterData(shape, *filter_data);
|
||||
|
||||
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);
|
||||
PhysX.PxBase_release(material);
|
||||
|
||||
physics_actor : PhysX_Actor;
|
||||
physics_actor.type = ifx e.physics.dynamic then .DYNAMIC else .STATIC;
|
||||
physics_actor.sync_rotation_from_physx = e.physics.type != .CAPSULE; // @Incomplete
|
||||
|
||||
if physics_actor.type == .DYNAMIC {
|
||||
physics_actor.dynamic = xx actor;
|
||||
} else {
|
||||
physics_actor.static = xx actor;
|
||||
}
|
||||
|
||||
e.physics.physx_handle = parray_add(*e.scene.physx_scene.actors, physics_actor);
|
||||
e.physics.enabled = true;
|
||||
}
|
||||
|
||||
shape := PhysX.PxPhysics_createShape(physics, geo, material, false, ifx e.physics.trigger then PHYSX_DEFAULT_TRIGGER_SHAPE_FLAGS else PHYSX_DEFAULT_SIMULATION_SHAPE_FLAGS);
|
||||
|
||||
// Setup layers
|
||||
filter_data := PhysX.PxFilterData_new();
|
||||
filter_data.word0 = 1;
|
||||
filter_data.word1 = 1;
|
||||
filter_data.word2 = 1;
|
||||
filter_data.word3 = 1;
|
||||
|
||||
PhysX.PxShape_setSimulationFilterData(shape, *filter_data);
|
||||
PhysX.PxShape_setQueryFilterData(shape, *filter_data);
|
||||
|
||||
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);
|
||||
PhysX.PxBase_release(material);
|
||||
|
||||
physics_actor : PhysX_Actor;
|
||||
physics_actor.type = ifx e.physics.dynamic then .DYNAMIC else .STATIC;
|
||||
physics_actor.sync_rotation_from_physx = e.physics.type != .CAPSULE; // @Incomplete
|
||||
|
||||
if physics_actor.type == .DYNAMIC {
|
||||
physics_actor.dynamic = xx actor;
|
||||
} else {
|
||||
physics_actor.static = xx actor;
|
||||
}
|
||||
|
||||
e.physics.physx_handle = parray_add(*e.scene.physx_scene.actors, physics_actor);
|
||||
e.physics.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Hit :: struct {
|
||||
|
||||
Reference in New Issue
Block a user