|
|
@@ -58,19 +58,35 @@ class SceneGraph;
|
|
|
|
|
|
struct Actor
|
|
|
{
|
|
|
+ /// Constructor
|
|
|
Actor(const PhysicsResource* res, const PhysicsConfigResource* config, uint32_t index, PxPhysics* physics, PxCooking* cooking,
|
|
|
PxScene* scene, SceneGraph& sg, int32_t node, const Vector3& pos, const Quaternion& rot);
|
|
|
+ /// Destructor
|
|
|
~Actor();
|
|
|
|
|
|
+ /// Makes the actor subject to gravity
|
|
|
void enable_gravity();
|
|
|
+
|
|
|
+ /// Makes the actor unsubject to gravity
|
|
|
void disable_gravity();
|
|
|
|
|
|
void enable_collision();
|
|
|
void disable_collision();
|
|
|
|
|
|
+ /// Makes the actor kinematic (keyframed)
|
|
|
+ /// @note
|
|
|
+ /// Works only for dynamic actors
|
|
|
void set_kinematic();
|
|
|
+
|
|
|
+ /// Makes the actor dynamic
|
|
|
+ /// @note
|
|
|
+ /// Works only for kinematic actors
|
|
|
void clear_kinematic();
|
|
|
- void move(const Matrix4x4& pose);
|
|
|
+
|
|
|
+ /// Moves the actor to @a pos
|
|
|
+ /// @note
|
|
|
+ /// Works only for kinematic actors
|
|
|
+ void move(const Vector3& pos);
|
|
|
|
|
|
/// Returns whether the actor is static (i.e. immovable).
|
|
|
bool is_static() const;
|
|
|
@@ -81,25 +97,60 @@ struct Actor
|
|
|
/// Returns whether the actor is kinematic (i.e. driven by the user).
|
|
|
bool is_kinematic() const;
|
|
|
|
|
|
+ /// Returns the rate at which rigid bodies dissipate linear momentum
|
|
|
float linear_damping() const;
|
|
|
+
|
|
|
+ /// Sets the rate at which rigid bodies dissipate linear momentum
|
|
|
void set_linear_damping(float rate);
|
|
|
|
|
|
+ /// Returns the rate at which rigid bodies dissipate angular momentum
|
|
|
float angular_damping() const;
|
|
|
+
|
|
|
+ /// Sets the rate at which rigid bodies dissipate angular momentum
|
|
|
void set_angular_damping(float rate);
|
|
|
|
|
|
+ /// Returns linear velocity of the actor
|
|
|
+ /// @note
|
|
|
+ /// If actor is sleeping, linear velocity must be 0
|
|
|
Vector3 linear_velocity() const;
|
|
|
+
|
|
|
+ /// Sets linear velocity of the actor
|
|
|
+ /// @note
|
|
|
+ /// If actor is sleeping, this will wake it up
|
|
|
void set_linear_velocity(const Vector3& vel);
|
|
|
|
|
|
+ /// Returns angular velocity of the actor
|
|
|
+ /// @note
|
|
|
+ /// If actor is sleeping, angular velocity must be 0
|
|
|
Vector3 angular_velocity() const;
|
|
|
+
|
|
|
+ /// Sets angular velocity of the actor
|
|
|
+ /// @note
|
|
|
+ /// If actor is sleeping, this will wake it up
|
|
|
void set_angular_velocity(const Vector3& vel);
|
|
|
|
|
|
+ /// Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.
|
|
|
+ /// @note
|
|
|
+ /// If the force does not act along the center of mass of the actor, this will also add the corresponding torque.
|
|
|
+ /// Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.
|
|
|
void add_impulse(const Vector3& impulse);
|
|
|
+
|
|
|
+ /// Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.
|
|
|
+ /// @note
|
|
|
+ /// If the force does not act along the center of mass of the actor, this will also add the corresponding torque.
|
|
|
+ /// Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.
|
|
|
void add_impulse_at(const Vector3& impulse, const Vector3& pos);
|
|
|
+
|
|
|
+ /// Applies a force, evaluated by actor's @a mass and @a velocity that will be achieved, to the actor
|
|
|
void push(const Vector3& vel, const float mass);
|
|
|
|
|
|
+ /// Returns true if tha actor is sleeping, false otherwise
|
|
|
bool is_sleeping();
|
|
|
+
|
|
|
+ /// Forces the actor to wake up
|
|
|
void wake_up();
|
|
|
|
|
|
+ /// Returns actor's name
|
|
|
StringId32 name();
|
|
|
|
|
|
private:
|