| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- $#include "PhysicsWorld.h"
- struct PhysicsRaycastResult
- {
- PhysicsRaycastResult();
- Vector3 position_ @ position;
- Vector3 normal_ @ normal;
- float distance_ @ distance;
- RigidBody* body_ @ body;
- };
- struct DelayedWorldTransform
- {
- RigidBody* rigidBody_ @ rigidBody;
- RigidBody* parentRigidBody_ @ parentRigidBody;
- Vector3 worldPosition_ @ worldPosition;
- Quaternion worldRotation_ @ worldRotation;
- };
- class PhysicsWorld : public Component
- {
- void Update(float timeStep);
- void UpdateCollisions();
- void SetFps(int fps);
- void SetGravity(Vector3 gravity);
- void SetNumIterations(int num);
- void SetInterpolation(bool enable);
- void SetInternalEdge(bool enable);
- void SetSplitImpulse(bool enable);
- void SetMaxNetworkAngularVelocity(float velocity);
- void RaycastSingle(PhysicsRaycastResult& result, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- void RaycastSingle(PhysicsRaycastResult& result, const Ray& ray, float maxDistance);
-
- void SphereCast(PhysicsRaycastResult& result, const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- void SphereCast(PhysicsRaycastResult& result, const Ray& ray, float radius, float maxDistance);
-
- Vector3 GetGravity() const;
- int GetNumIterations() const;
- bool GetInterpolation() const;
- bool GetInternalEdge() const;
- bool GetSplitImpulse() const;
- int GetFps() const;
- float GetMaxNetworkAngularVelocity() const;
- void AddRigidBody(RigidBody* body);
- void RemoveRigidBody(RigidBody* body);
- void AddCollisionShape(CollisionShape* shape);
- void RemoveCollisionShape(CollisionShape* shape);
- void AddConstraint(Constraint* joint);
- void RemoveConstraint(Constraint* joint);
- void AddDelayedWorldTransform(const DelayedWorldTransform& transform);
- void DrawDebugGeometry(bool depthTest);
- void SetDebugRenderer(DebugRenderer* debug);
- void SetDebugDepthTest(bool enable);
-
- void CleanupGeometryCache();
- void SetApplyingTransforms(bool enable);
- bool IsApplyingTransforms() const;
-
- // Properties:
- tolua_property__get_set Vector3 gravity;
- tolua_property__get_set int numIterations;
- tolua_property__get_set bool interpolation;
- tolua_property__get_set bool internalEdge;
- tolua_property__get_set bool splitImpulse;
- tolua_property__get_set int fps;
- tolua_property__get_set float maxNetworkAngularVelocity;
- tolua_property__is_set bool applyingTransforms;
- };
|