9#ifndef AVARA3D_PHYSICS_PROXY_PHYSICSBODYPROXY_H
10#define AVARA3D_PHYSICS_PROXY_PHYSICSBODYPROXY_H
12#include "a3d/physics/PhysicsBody.h"
17 class PhysicsShapeProxy;
19 class PhysicsBodyProxy {
26 PhysicsBodyProxy(
const PhysicsBodyProxy&) =
delete;
27 PhysicsBodyProxy& operator=(
const PhysicsBodyProxy&) =
delete;
29 PhysicsBodyProxy(PhysicsBodyProxy&&) =
delete;
30 PhysicsBodyProxy& operator=(PhysicsBodyProxy&&) =
delete;
32 virtual ~PhysicsBodyProxy();
39 virtual PhysicsShapeProxy* shapeProxy()
const = 0;
40 virtual void shapeProxy(PhysicsShapeProxy* proxy) = 0;
42 virtual float mass()
const = 0;
43 virtual void mass(
float mass) = 0;
45 virtual math::vec3 momentOfInertia()
const = 0;
46 virtual void momentOfInertia(
const math::vec3& moment) = 0;
48 virtual math::vec3 centerOfMass()
const = 0;
49 virtual void centerOfMass(
const math::vec3& offset) = 0;
51 virtual float friction()
const = 0;
52 virtual void friction(
float friction) = 0;
54 virtual float rollingFriction()
const = 0;
55 virtual void rollingFriction(
float friction) = 0;
57 virtual float spinningFriction()
const = 0;
58 virtual void spinningFriction(
float friction) = 0;
60 virtual float restitution()
const = 0;
61 virtual void restitution(
float restitution) = 0;
63 virtual math::vec3 linearVelocity()
const = 0;
64 virtual void linearVelocity(
const math::vec3& velocity) = 0;
66 virtual math::vec3 angularVelocity()
const = 0;
67 virtual void angularVelocity(
const math::vec3& velocity) = 0;
69 virtual math::vec3 linearFactor()
const = 0;
70 virtual void linearFactor(
const math::vec3& factor) = 0;
72 virtual math::vec3 angularFactor()
const = 0;
73 virtual void angularFactor(
const math::vec3& factor) = 0;
75 virtual float linearDamping()
const = 0;
76 virtual void linearDamping(
float damping) = 0;
78 virtual float angularDamping()
const = 0;
79 virtual void angularDamping(
float damping) = 0;
81 virtual float linearSleepingThreshold()
const = 0;
82 virtual void linearSleepingThreshold(
float threshold) = 0;
84 virtual float angularSleepingThreshold()
const = 0;
85 virtual void angularSleepingThreshold(
float threshold) = 0;
87 virtual void applyForce(
const math::vec3& force,
const math::vec3& worldPosition) = 0;
88 virtual void applyCentralForce(
const math::vec3& force) = 0;
90 virtual void applyImpulse(
const math::vec3& impulse,
const math::vec3& worldPosition) = 0;
91 virtual void applyCentralImpulse(
const math::vec3& impulse) = 0;
93 virtual void applyTorque(
const math::vec3& torque) = 0;
94 virtual void applyTorqueImpulse(
const math::vec3& torque) = 0;
96 virtual math::vec3 totalForce()
const = 0;
97 virtual math::vec3 totalTorque()
const = 0;
99 virtual void ccdEnabled(
bool enabled) = 0;
100 virtual bool ccdEnabled()
const = 0;
102 virtual void ccdMotionThreshold(
float distance) = 0;
103 virtual float ccdMotionThreshold()
const = 0;
105 virtual void ccdSweptSphereRadius(
float radius) = 0;
106 virtual float ccdSweptSphereRadius()
const = 0;
108 virtual bool affectedByGravity()
const = 0;
109 virtual void affectedByGravity(
bool affectedByGravity) = 0;
111 virtual bool allowsResting()
const = 0;
112 virtual void allowsResting(
bool allowsResting) = 0;
114 virtual bool resting()
const = 0;
115 virtual void resting(
bool resting) = 0;
117 virtual void clearForces() = 0;
119 virtual void worldTransform(
const math::mat4& worldTransform) = 0;
121 virtual bool autocalculatesCenterOfMass()
const;
122 virtual void autocalculatesCenterOfMass(
bool autocalculate);
127 virtual bool autocalculatesMomentOfInertia()
const;
128 virtual void autocalculatesMomentOfInertia(
bool autocalculate);
130 void attachedToBody(PhysicsBody& body);
131 void detachedFromBody(PhysicsBody& body);
137 PhysicsShapeProxy* _shapeProxy;
138 math::vec3 _centerOfMass;
139 bool _autocalculatesCenterOfMass;
141 bool _autocalculatesMomentOfInertia;
Type
Determines how a rigid body participates in simulation.
CenterOfMassCalculation
Selects the method used to automatically determine a dynamic body's center of mass.