CollisionShape.pkg 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $#include "CollisionShape.h"
  2. enum ShapeType
  3. {
  4. SHAPE_BOX = 0,
  5. SHAPE_SPHERE,
  6. SHAPE_STATICPLANE,
  7. SHAPE_CYLINDER,
  8. SHAPE_CAPSULE,
  9. SHAPE_CONE,
  10. SHAPE_TRIANGLEMESH,
  11. SHAPE_CONVEXHULL,
  12. SHAPE_TERRAIN
  13. };
  14. class CollisionShape : public Component
  15. {
  16. void SetBox(const Vector3& size, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  17. void SetSphere(float diameter, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  18. void SetStaticPlane(const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  19. void SetCylinder(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  20. void SetCapsule(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  21. void SetCone(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  22. void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  23. void SetCustomTriangleMesh(CustomGeometry* custom, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  24. void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  25. void SetCustomConvexHull(CustomGeometry* custom, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  26. void SetTerrain();
  27. void SetShapeType(ShapeType type);
  28. void SetSize(const Vector3& size);
  29. void SetPosition(const Vector3& position);
  30. void SetRotation(const Quaternion& rotation);
  31. void SetTransform(const Vector3& position, const Quaternion& rotation);
  32. void SetMargin(float margin);
  33. void SetModel(Model* model);
  34. void SetLodLevel(unsigned lodLevel);
  35. PhysicsWorld* GetPhysicsWorld() const;
  36. ShapeType GetShapeType() const;
  37. const Vector3& GetSize() const;
  38. const Vector3& GetPosition() const;
  39. const Quaternion& GetRotation() const;
  40. float GetMargin() const;
  41. Model* GetModel() const;
  42. unsigned GetLodLevel() const;
  43. BoundingBox GetWorldBoundingBox() const;
  44. tolua_readonly tolua_property__get_set PhysicsWorld* physicsWorld;
  45. tolua_property__get_set ShapeType shapeType;
  46. tolua_property__get_set Vector3& size;
  47. tolua_property__get_set Vector3& position;
  48. tolua_property__get_set Quaternion& rotation;
  49. tolua_property__get_set float margin;
  50. tolua_property__get_set Model* model;
  51. tolua_property__get_set unsigned lodLevel;
  52. tolua_readonlytolua_property__get_set BoundingBox worldBoundingBox;
  53. tolua_property__get_set ResourceRef modelAttr;
  54. };