CollisionShape.pkg 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
  24. void SetTerrain();
  25. void SetShapeType(ShapeType type);
  26. void SetSize(const Vector3& size);
  27. void SetPosition(const Vector3& position);
  28. void SetRotation(const Quaternion& rotation);
  29. void SetTransform(const Vector3& position, const Quaternion& rotation);
  30. void SetMargin(float margin);
  31. void SetModel(Model* model);
  32. void SetLodLevel(unsigned lodLevel);
  33. PhysicsWorld* GetPhysicsWorld() const;
  34. ShapeType GetShapeType() const;
  35. const Vector3& GetSize() const;
  36. const Vector3& GetPosition() const;
  37. const Quaternion& GetRotation() const;
  38. float GetMargin() const;
  39. Model* GetModel() const;
  40. unsigned GetLodLevel() const;
  41. BoundingBox GetWorldBoundingBox() const;
  42. void NotifyRigidBody(bool updateMass = true);
  43. void SetModelAttr(ResourceRef value);
  44. ResourceRef GetModelAttr() const;
  45. void ReleaseShape();
  46. tolua_readonly tolua_property__get_set PhysicsWorld* physicsWorld;
  47. tolua_property__get_set ShapeType shapeType;
  48. tolua_property__get_set Vector3& size;
  49. tolua_property__get_set Vector3& position;
  50. tolua_property__get_set Quaternion& rotation;
  51. tolua_property__get_set float margin;
  52. tolua_property__get_set Model* model;
  53. tolua_property__get_set unsigned lodLevel;
  54. tolua_readonlytolua_property__get_set BoundingBox worldBoundingBox;
  55. tolua_property__get_set ResourceRef modelAttr;
  56. };