CollisionShape.pkg 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 SetBox(const Vector3& size, const Vector3& position = Vector3::ZERO);
  18. void SetBox(const Vector3& size);
  19. void SetSphere(float diameter, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  20. void SetSphere(float diameter, const Vector3& position = Vector3::ZERO);
  21. void SetSphere(float diameter);
  22. void SetStaticPlane(const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  23. void SetStaticPlane(const Vector3& position = Vector3::ZERO);
  24. void SetStaticPlane();
  25. void SetCylinder(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  26. void SetCylinder(float diameter, float height, const Vector3& position = Vector3::ZERO);
  27. void SetCylinder(float diameter, float height);
  28. void SetCapsule(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  29. void SetCapsule(float diameter, float height, const Vector3& position = Vector3::ZERO);
  30. void SetCapsule(float diameter, float height);
  31. void SetCone(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  32. void SetCone(float diameter, float height, const Vector3& position = Vector3::ZERO);
  33. void SetCone(float diameter, float height);
  34. void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  35. void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO);
  36. void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE);
  37. void SetTriangleMesh(Model* model, unsigned lodLevel = 0);
  38. void SetTriangleMesh(Model* model);
  39. void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  40. void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO);
  41. void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE);
  42. void SetConvexHull(Model* model, unsigned lodLevel = 0);
  43. void SetConvexHull(Model* model);
  44. void SetTerrain();
  45. void SetShapeType(ShapeType type);
  46. void SetSize(const Vector3& size);
  47. void SetPosition(const Vector3& position);
  48. void SetRotation(const Quaternion& rotation);
  49. void SetTransform(const Vector3& position, const Quaternion& rotation);
  50. void SetMargin(float margin);
  51. void SetModel(Model* model);
  52. void SetLodLevel(unsigned lodLevel);
  53. PhysicsWorld* GetPhysicsWorld() const;
  54. ShapeType GetShapeType() const;
  55. const Vector3& GetSize() const;
  56. const Vector3& GetPosition() const;
  57. const Quaternion& GetRotation() const;
  58. float GetMargin() const;
  59. Model* GetModel() const;
  60. unsigned GetLodLevel() const;
  61. BoundingBox GetWorldBoundingBox() const;
  62. void NotifyRigidBody(bool updateMass = true);
  63. void NotifyRigidBody();
  64. void SetModelAttr(ResourceRef value);
  65. ResourceRef GetModelAttr() const;
  66. void ReleaseShape();
  67. // Properties:
  68. tolua_readonly tolua_property__get_set PhysicsWorld* physicsWorld;
  69. tolua_property__get_set ShapeType shapeType;
  70. tolua_property__get_set Vector3& size;
  71. tolua_property__get_set Vector3& position;
  72. tolua_property__get_set Quaternion& rotation;
  73. tolua_property__get_set float margin;
  74. tolua_property__get_set Model* model;
  75. tolua_property__get_set unsigned lodLevel;
  76. tolua_readonlytolua_property__get_set BoundingBox worldBoundingBox;
  77. tolua_property__get_set ResourceRef modelAttr;
  78. };