@@ -71,6 +71,15 @@ public: | |||||
MeshRand << "[sc#ada scb#ada ad16 2 0 rx180 ty-1 my ac16 2 2 2 0 0]"; | MeshRand << "[sc#ada scb#ada ad16 2 0 rx180 ty-1 my ac16 2 2 2 0 0]"; | ||||
MeshRand << "[sc#aad scb#aad ad16 2 0 rx180 ty-1 my ac16 2 2 2 0 0]"; | MeshRand << "[sc#aad scb#aad ad16 2 0 rx180 ty-1 my ac16 2 2 2 0 0]"; | ||||
int CapsLimit = MeshRand.Count(); | |||||
MeshRand << "[sc#add scb#add asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]"; | |||||
MeshRand << "[sc#dad scb#dad asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]"; | |||||
MeshRand << "[sc#dda scb#dda asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]"; | |||||
MeshRand << "[sc#daa scb#daa asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]"; | |||||
MeshRand << "[sc#ada scb#ada asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]"; | |||||
MeshRand << "[sc#aad scb#aad asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]"; | |||||
int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1)); | int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1)); | ||||
m_mesh.Compile(MeshRand[RandValue]); | m_mesh.Compile(MeshRand[RandValue]); | ||||
@@ -81,8 +90,10 @@ public: | |||||
m_physics.SetShapeToSphere(BoxSize.x); | m_physics.SetShapeToSphere(BoxSize.x); | ||||
else if (RandValue < CylLimit) | else if (RandValue < CylLimit) | ||||
m_physics.SetShapeToCone(BoxSize.x, BoxSize.y); | m_physics.SetShapeToCone(BoxSize.x, BoxSize.y); | ||||
else | |||||
else if (RandValue < CapsLimit) | |||||
m_physics.SetShapeToCylinder(BoxSize); | m_physics.SetShapeToCylinder(BoxSize); | ||||
else | |||||
m_physics.SetShapeToCapsule(BoxSize.x, BoxSize.y); | |||||
m_physics.SetMass(base_mass); | m_physics.SetMass(base_mass); | ||||
m_physics.SetBaseTransform(base_location); | m_physics.SetBaseTransform(base_location); | ||||
@@ -93,6 +93,12 @@ void EasyPhysics::SetShapeToCylinder(lol::vec3& cyl_size) | |||||
SetShapeTo(new btCylinderShape(LOL2BT_VEC3(new_cyl_size))); | SetShapeTo(new btCylinderShape(LOL2BT_VEC3(new_cyl_size))); | ||||
} | } | ||||
void EasyPhysics::SetShapeToCapsule(float radius, float height) | |||||
{ | |||||
SetShapeTo(new btCapsuleShape( radius * LOL2BT_UNIT * LOL2BT_SIZE, | |||||
height * LOL2BT_UNIT * LOL2BT_SIZE)); | |||||
} | |||||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
//Base Location/Rotation setup | //Base Location/Rotation setup | ||||
//-- | //-- | ||||
@@ -40,6 +40,7 @@ public: | |||||
void SetShapeToSphere(float radius); | void SetShapeToSphere(float radius); | ||||
void SetShapeToCone(float radius, float height); | void SetShapeToCone(float radius, float height); | ||||
void SetShapeToCylinder(lol::vec3& cyl_size); | void SetShapeToCylinder(lol::vec3& cyl_size); | ||||
void SetShapeToCapsule(float radius, float height); | |||||
void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))); | void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))); | ||||
void SetMass(float mass); | void SetMass(float mass); | ||||
@@ -67,6 +68,10 @@ public: | |||||
void SetShapeToBox(lol::vec3& BoxSize) { } | void SetShapeToBox(lol::vec3& BoxSize) { } | ||||
void SetShapeToSphere(float radius) { } | void SetShapeToSphere(float radius) { } | ||||
void SetShapeToCone(float radius, float height) { } | |||||
void SetShapeToCylinder(lol::vec3& cyl_size) { } | |||||
void SetShapeToCapsule(float radius, float height) { } | |||||
void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { } | void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { } | ||||
void SetMass(float mass) { } | void SetMass(float mass) { } | ||||
void InitBodyToRigid() { } | void InitBodyToRigid() { } | ||||