Small fixes

This commit is contained in:
Diren D Bharwani 2022-11-12 17:28:49 +08:00
parent 4ad23a605f
commit f8bbcdd909
5 changed files with 10 additions and 8 deletions

View File

@ -4,7 +4,7 @@
NumberOfChildren: 0
Components:
Camera Component:
Position: {x: 0, y: 0, z: 0}
Position: {x: 0, y: 0, z: 8}
Pitch: 0
Yaw: 0
Roll: 0
@ -233,9 +233,9 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -4.49353218, y: 2.57871056, z: -5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0.99998343, y: 0.999987662, z: 0.999981642}
Translate: {x: -4.40482807, y: 2.57871056, z: -5.21213436}
Rotate: {x: -0.361265004, y: 1.11661232, z: -0.626627684}
Scale: {x: 0.999982238, y: 0.999987125, z: 0.999981165}
RigidBody Component:
Type: Dynamic
Mass: 1

View File

@ -237,6 +237,7 @@ namespace SHADE
case 9: // Mass
{
rp3dBody->setMass(component.mass);
rp3dBody->updateLocalCenterOfMassFromColliders();
rp3dBody->updateLocalInertiaTensorFromColliders();
break;

View File

@ -37,9 +37,9 @@ namespace SHADE
factory = &physicsFactory;
}
void SHPhysicsObjectManager::SetWorld(rp3d::PhysicsWorld& physicsWorld) noexcept
void SHPhysicsObjectManager::SetWorld(rp3d::PhysicsWorld* physicsWorld) noexcept
{
world = &physicsWorld;
world = physicsWorld;
}
/*-----------------------------------------------------------------------------------*/

View File

@ -84,7 +84,7 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/
void SetFactory (rp3d::PhysicsCommon& physicsFactory) noexcept;
void SetWorld (rp3d::PhysicsWorld& physicsWorld) noexcept;
void SetWorld (rp3d::PhysicsWorld* physicsWorld) noexcept;
/*---------------------------------------------------------------------------------*/
/* Function Members */

View File

@ -273,7 +273,7 @@ namespace SHADE
collisionListener.BindToWorld(worldState.world);
// Link with object manager & create all physics objects
objectManager.SetWorld(*worldState.world);
objectManager.SetWorld(worldState.world);
const auto& RIGIDBODY_DENSE = SHComponentManager::GetDense<SHRigidBodyComponent>();
const auto& COLLIDER_DENSE = SHComponentManager::GetDense<SHColliderComponent>();
@ -291,6 +291,7 @@ namespace SHADE
{
// Remove all physics objects
objectManager.RemoveAllObjects();
objectManager.SetWorld(nullptr);
// Clear all collision info
// Collision listener is automatically unbound when world is destroyed