RigidBody.pkg 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. $#include "RigidBody.h"
  2. enum CollisionEventMode
  3. {
  4. COLLISION_NEVER = 0,
  5. COLLISION_ACTIVE,
  6. COLLISION_ALWAYS
  7. };
  8. class RigidBody : public Component
  9. {
  10. void SetMass(float mass);
  11. void SetPosition(const Vector3& position);
  12. void SetRotation(const Quaternion& rotation);
  13. void SetTransform(const Vector3& position, const Quaternion& rotation);
  14. void SetLinearVelocity(const Vector3& velocity);
  15. void SetLinearFactor(const Vector3& factor);
  16. void SetLinearRestThreshold(float threshold);
  17. void SetLinearDamping(float damping);
  18. void SetAngularVelocity(const Vector3& angularVelocity);
  19. void SetAngularFactor(const Vector3& factor);
  20. void SetAngularRestThreshold(float threshold);
  21. void SetAngularDamping(float factor);
  22. void SetFriction(float friction);
  23. void SetAnisotropicFriction(const Vector3& friction);
  24. void SetRollingFriction(float friction);
  25. void SetRestitution(float restitution);
  26. void SetContactProcessingThreshold(float threshold);
  27. void SetCcdRadius(float radius);
  28. void SetCcdMotionThreshold(float threshold);
  29. void SetUseGravity(bool enable);
  30. void SetGravityOverride(const Vector3& gravity);
  31. void SetKinematic(bool enable);
  32. void SetTrigger(bool enable);
  33. void SetCollisionLayer(unsigned layer);
  34. void SetCollisionMask(unsigned mask);
  35. void SetCollisionLayerAndMask(unsigned layer, unsigned mask);
  36. void SetCollisionEventMode(CollisionEventMode mode);
  37. void DisableMassUpdate();
  38. void EnableMassUpdate();
  39. void ApplyForce(const Vector3& force);
  40. void ApplyForce(const Vector3& force, const Vector3& position);
  41. void ApplyTorque(const Vector3& torque);
  42. void ApplyImpulse(const Vector3& impulse);
  43. void ApplyImpulse(const Vector3& impulse, const Vector3& position);
  44. void ApplyTorqueImpulse(const Vector3& torque);
  45. void ResetForces();
  46. void Activate();
  47. void ReAddBodyToWorld();
  48. PhysicsWorld* GetPhysicsWorld() const;
  49. float GetMass() const;
  50. Vector3 GetPosition() const;
  51. Quaternion GetRotation() const;
  52. Vector3 GetLinearVelocity() const;
  53. Vector3 GetLinearFactor() const;
  54. Vector3 GetVelocityAtPoint(const Vector3& position) const;
  55. float GetLinearRestThreshold() const;
  56. float GetLinearDamping() const;
  57. Vector3 GetAngularVelocity() const;
  58. Vector3 GetAngularFactor() const;
  59. float GetAngularRestThreshold() const;
  60. float GetAngularDamping() const;
  61. float GetFriction() const;
  62. Vector3 GetAnisotropicFriction() const;
  63. float GetRollingFriction() const;
  64. float GetRestitution() const;
  65. float GetContactProcessingThreshold() const;
  66. float GetCcdRadius() const;
  67. float GetCcdMotionThreshold() const;
  68. bool GetUseGravity() const;
  69. const Vector3& GetGravityOverride() const;
  70. const Vector3& GetCenterOfMass() const;
  71. bool IsKinematic() const;
  72. bool IsTrigger() const;
  73. bool IsActive() const;
  74. unsigned GetCollisionLayer() const;
  75. unsigned GetCollisionMask() const;
  76. CollisionEventMode GetCollisionEventMode() const;
  77. tolua_readonly tolua_property__get_set PhysicsWorld* physicsWorld;
  78. tolua_property__get_set float mass;
  79. tolua_property__get_set Vector3 position;
  80. tolua_property__get_set Quaternion rotation;
  81. tolua_property__get_set Vector3 linearVelocity;
  82. tolua_property__get_set Vector3 linearFactor;
  83. tolua_property__get_set float linearRestThreshold;
  84. tolua_property__get_set float linearDamping;
  85. tolua_property__get_set Vector3 angularVelocity;
  86. tolua_property__get_set Vector3 angularFactor;
  87. tolua_property__get_set float angularRestThreshold;
  88. tolua_property__get_set float angularDamping;
  89. tolua_property__get_set float friction;
  90. tolua_property__get_set Vector3 anisotropicFriction;
  91. tolua_property__get_set float rollingFriction;
  92. tolua_property__get_set float restitution;
  93. tolua_property__get_set float contactProcessingThreshold;
  94. tolua_property__get_set float ccdRadius;
  95. tolua_property__get_set float ccdMotionThreshold;
  96. tolua_property__get_set bool useGravity;
  97. tolua_property__get_set Vector3& gravityOverride;
  98. tolua_readonly tolua_property__get_set Vector3& centerOfMass;
  99. tolua_property__is_set bool kinematic;
  100. tolua_property__is_set bool trigger;
  101. tolua_readonly tolua_property__is_set bool active;
  102. tolua_property__get_set unsigned collisionLayer;
  103. tolua_property__get_set unsigned collisionMask;
  104. tolua_property__get_set CollisionEventMode collisionEventMode;
  105. };