| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- $#include "PhysicsWorld.h"
- struct PhysicsRaycastResult
- {
- PhysicsRaycastResult();
- Vector3 position_ @ position;
- Vector3 normal_ @ normal;
- float distance_ @ distance;
- RigidBody* body_ @ body;
- };
- 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 Raycast(const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- tolua_outside const PODVector<PhysicsRaycastResult>& PhysicsWorldRaycast @ Raycast(const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- // void RaycastSingle(PhysicsRaycastResult& result, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- tolua_outside PhysicsRaycastResult PhysicsWorldRaycastSingle @ RaycastSingle(const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- // void SphereCast(PhysicsRaycastResult& result, const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- tolua_outside PhysicsRaycastResult PhysicsWorldSphereCast @ SphereCast(const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
- void DrawDebugGeometry(bool depthTest);
- void RemoveCachedGeometry(Model* model);
- Vector3 GetGravity() const;
- int GetNumIterations() const;
- bool GetInterpolation() const;
- bool GetInternalEdge() const;
- bool GetSplitImpulse() const;
- int GetFps() const;
- float GetMaxNetworkAngularVelocity() const;
- 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;
- };
- ${
- static const PODVector<PhysicsRaycastResult>& PhysicsWorldRaycast(PhysicsWorld* physicsWorld, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED)
- {
- static PODVector<PhysicsRaycastResult> result;
- result.Clear();
- physicsWorld->Raycast(result, ray, maxDistance, collisionMask);
- return result;
- }
- static PhysicsRaycastResult PhysicsWorldRaycastSingle(PhysicsWorld* physicsWorld, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED)
- {
- PhysicsRaycastResult result;
- physicsWorld->RaycastSingle(result, ray, maxDistance, collisionMask);
- return result;
- }
- PhysicsRaycastResult PhysicsWorldSphereCast(PhysicsWorld* physicsWorld, const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED)
- {
- PhysicsRaycastResult result;
- physicsWorld->SphereCast(result, ray, radius, maxDistance, collisionMask);
- return result;
- }
- $}
|