diff --git a/test/PhysicObject.h b/test/PhysicObject.h index 9b36c981..5a2724cf 100644 --- a/test/PhysicObject.h +++ b/test/PhysicObject.h @@ -44,11 +44,24 @@ public: MeshRand << "[sc#ada afcb2 2 2 -.1]"; MeshRand << "[sc#aad afcb2 2 2 -.1]"; + int SphereLimit = MeshRand.Count(); + + MeshRand << "[sc#add asph16 2 2 2]"; + MeshRand << "[sc#dad asph16 2 2 2]"; + MeshRand << "[sc#dda asph16 2 2 2]"; + MeshRand << "[sc#daa asph16 2 2 2]"; + MeshRand << "[sc#ada asph16 2 2 2]"; + MeshRand << "[sc#aad asph16 2 2 2]"; + + int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1)); m_mesh.Compile(MeshRand[RandValue]); vec3 BoxSize = vec3(2.0f); - m_physics.SetShapeToBox(BoxSize); + if (RandValue >= SphereLimit) + m_physics.SetShapeToSphere(BoxSize.x); + else + m_physics.SetShapeToBox(BoxSize); m_physics.SetMass(base_mass); m_physics.SetBaseTransform(base_location); m_physics.InitBodyToRigid(); diff --git a/test/Physics/EasyPhysics.cpp b/test/Physics/EasyPhysics.cpp index 53a18a3b..6d98970d 100644 --- a/test/Physics/EasyPhysics.cpp +++ b/test/Physics/EasyPhysics.cpp @@ -68,10 +68,10 @@ void EasyPhysics::SetShapeToBox(lol::vec3& box_size) SetShapeTo(new btBoxShape(LOL2BT_VEC3(new_box_size))); } -//void EasyPhysics::SetShapeToSphere(lol::vec3& box_size) -//{ -// SetShapeTo(new btBoxShape(LOL2BT_VEC3(box_size * LOL2BT_UNIT * LOL2BT_SIZE))); -//} +void EasyPhysics::SetShapeToSphere(float radius) +{ + SetShapeTo(new btSphereShape(radius * LOL2BT_UNIT * LOL2BT_SIZE)); +} //------------------------------------------------------------------------- //Base Location/Rotation setup diff --git a/test/Physics/EasyPhysics.h b/test/Physics/EasyPhysics.h index 5828def7..6cc4f290 100644 --- a/test/Physics/EasyPhysics.h +++ b/test/Physics/EasyPhysics.h @@ -36,6 +36,7 @@ public: EasyPhysics(); void SetShapeToBox(lol::vec3& box_size); + void SetShapeToSphere(float radius); void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))); void SetMass(float mass); void InitBodyToRigid();