| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- $#include "PhysicsWorld2D.h"
- struct PhysicsRaycastResult2D
- {
- PhysicsRaycastResult2D();
- ~PhysicsRaycastResult2D();
-
- Vector2 position_ @ position;
- Vector2 normal_ @ normal;
- float distance_ @ distance;
- RigidBody2D* body_ @ body;
- };
- class PhysicsWorld2D : Component
- {
- void DrawDebugGeometry();
- void SetDrawShape(bool drawShape);
- void SetDrawJoint(bool drawJoint);
- void SetDrawAabb(bool drawAabb);
- void SetDrawPair(bool drawPair);
- void SetDrawCenterOfMass(bool drawCenterOfMass);
- void SetAllowSleeping(bool enable);
- void SetWarmStarting(bool enable);
- void SetContinuousPhysics(bool enable);
- void SetSubStepping(bool enable);
- void SetGravity(const Vector2& gravity);
- void SetAutoClearForces(bool enable);
- void SetVelocityIterations(int velocityIterations);
- void SetPositionIterations(int positionIterations);
- // void Raycast(PODVector<PhysicsRaycastResult2D>& results, const Vector2& startPoint, const Vector2& endPoint, unsigned collisionMask = M_MAX_UNSIGNED);
- tolua_outside const PODVector<PhysicsRaycastResult2D>& PhysicsWorld2DRaycast @ Raycast(const Vector2& startPoint, const Vector2& endPoint, unsigned collisionMask = M_MAX_UNSIGNED);
- // void RaycastSingle(PhysicsRaycastResult2D& result, const Vector2& startPoint, const Vector2& endPoint, unsigned collisionMask = M_MAX_UNSIGNED);
- tolua_outside PhysicsRaycastResult2D PhysicsWorld2DRaycastSingle @ RaycastSingle(const Vector2& startPoint, const Vector2& endPoint, unsigned collisionMask = M_MAX_UNSIGNED);
- RigidBody2D* GetRigidBody(const Vector2& point, unsigned collisionMask = M_MAX_UNSIGNED);
- RigidBody2D* GetRigidBody(int screenX, int screenY, unsigned collisionMask = M_MAX_UNSIGNED);
- // void GetRigidBodies(PODVector<RigidBody2D*>& result, const Rect& aabb, unsigned collisionMask = M_MAX_UNSIGNED);
- tolua_outside const PODVector<RigidBody2D*>& PhysicsWorld2DGetRigidBodies @ GetRigidBodies(const Rect& aabb, unsigned collisionMask = M_MAX_UNSIGNED);
- bool GetDrawShape() const;
- bool GetDrawJoint() const;
- bool GetDrawAabb() const;
- bool GetDrawPair() const;
- bool GetDrawCenterOfMass() const;
- bool GetAllowSleeping() const;
- bool GetWarmStarting() const;
- bool GetContinuousPhysics() const;
- bool GetSubStepping() const;
- bool GetAutoClearForces() const;
- const Vector2& GetGravity() const;
- int GetVelocityIterations() const;
- int GetPositionIterations() const;
- tolua_property__get_set bool drawShape;
- tolua_property__get_set bool drawJoint;
- tolua_property__get_set bool drawAabb;
- tolua_property__get_set bool drawPair;
- tolua_property__get_set bool drawCenterOfMass;
- tolua_property__get_set bool allowSleeping;
- tolua_property__get_set bool warmStarting;
- tolua_property__get_set bool continuousPhysics;
- tolua_property__get_set bool subStepping;
- tolua_property__get_set bool autoClearForces;
- tolua_property__get_set Vector2& gravity;
- tolua_property__get_set int velocityIterations;
- tolua_property__get_set int positionIterations;
- };
- ${
- const PODVector<PhysicsRaycastResult2D>& PhysicsWorld2DRaycast(PhysicsWorld2D* physicsWorld, const Vector2& startPoint, const Vector2& endPoint, unsigned collisionMask = M_MAX_UNSIGNED)
- {
- static PODVector<PhysicsRaycastResult2D> results;
- results.Clear();
- physicsWorld->Raycast(results, startPoint, endPoint, collisionMask);
- return results;
- }
- PhysicsRaycastResult2D PhysicsWorld2DRaycastSingle(PhysicsWorld2D* physicsWorld, const Vector2& startPoint, const Vector2& endPoint, unsigned collisionMask = M_MAX_UNSIGNED)
- {
- PhysicsRaycastResult2D result;
- physicsWorld->RaycastSingle(result, startPoint, endPoint, collisionMask);
- return result;
- }
- const PODVector<RigidBody2D*>& PhysicsWorld2DGetRigidBodies(PhysicsWorld2D* physicsWorld, const Rect& aabb, unsigned collisionMask = M_MAX_UNSIGNED)
- {
- static PODVector<RigidBody2D*> results;
- results.Clear();
- physicsWorld->GetRigidBodies(results, aabb, collisionMask);
- return results;
- }
- $}
|