Fixed various Physics bugs #217
|
@ -304,6 +304,9 @@ namespace SHADE
|
|||
const auto* RHS_BOX = reinterpret_cast<const SHBox*>(rhs);
|
||||
|
||||
shape = new SHBox{ positionOffset, RHS_BOX->GetWorldExtents() };
|
||||
auto* lhsBox = reinterpret_cast<SHBox*>(shape);
|
||||
lhsBox->SetRelativeExtents(RHS_BOX->GetRelativeExtents());
|
||||
|
||||
break;
|
||||
}
|
||||
case Type::SPHERE:
|
||||
|
@ -311,6 +314,9 @@ namespace SHADE
|
|||
const auto* RHS_SPHERE = reinterpret_cast<const SHSphere*>(rhs);
|
||||
|
||||
shape = new SHSphere{ positionOffset, RHS_SPHERE->GetWorldRadius() };
|
||||
auto* lhsSphere = reinterpret_cast<SHSphere*>(shape);
|
||||
lhsSphere->SetRelativeRadius(RHS_SPHERE->GetRelativeRadius());
|
||||
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
|
|
@ -109,14 +109,25 @@ namespace SHADE
|
|||
{
|
||||
// TODO(Diren): Add more collider shapes
|
||||
|
||||
case SHCollisionShape::Type::BOX: addBoxShape(collisionShape); break;
|
||||
case SHCollisionShape::Type::SPHERE: addSphereShape(collisionShape); break;
|
||||
case SHCollisionShape::Type::BOX:
|
||||
{
|
||||
addBoxShape(collisionShape);
|
||||
break;
|
||||
}
|
||||
|
||||
case SHCollisionShape::Type::SPHERE:
|
||||
{
|
||||
addSphereShape(collisionShape);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
rp3dBody->updateLocalCenterOfMassFromColliders();
|
||||
rp3dBody->updateLocalInertiaTensorFromColliders();
|
||||
|
||||
SyncColliders(*colliderComponent);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace SHADE
|
|||
/*-------------------------------------------------------------------------------*/
|
||||
|
||||
SHVec3 gravity = SHVec3{ 0.0f, -9.81f, 0.0f };
|
||||
uint16_t numVelocitySolverIterations = 15;
|
||||
uint16_t numPositionSolverIterations = 8;
|
||||
uint16_t numVelocitySolverIterations = 10;
|
||||
uint16_t numPositionSolverIterations = 5;
|
||||
bool sleepingEnabled = true;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue