Physics2D/RigidBody2D: AddTorque now takes a RadianAnglesf instead of a float
This commit is contained in:
parent
d2b1d51ecb
commit
3933d5007d
|
|
@ -32,7 +32,7 @@ namespace Ndk
|
|||
inline void AddForce(const Nz::Vector2f& force, const Nz::Vector2f& point, Nz::CoordSys coordSys = Nz::CoordSys_Global);
|
||||
inline void AddImpulse(const Nz::Vector2f& impulse, Nz::CoordSys coordSys = Nz::CoordSys_Global);
|
||||
inline void AddImpulse(const Nz::Vector2f& impulse, const Nz::Vector2f& point, Nz::CoordSys coordSys = Nz::CoordSys_Global);
|
||||
inline void AddTorque(float torque);
|
||||
inline void AddTorque(const Nz::RadianAnglef& torque);
|
||||
|
||||
inline bool ClosestPointQuery(const Nz::Vector2f& position, Nz::Vector2f* closestPoint, float* closestDistance) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace Ndk
|
|||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent2D::AddTorque(float torque)
|
||||
inline void PhysicsComponent2D::AddTorque(const Nz::RadianAnglef& torque)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Nz
|
|||
void AddForce(const Vector2f& force, const Vector2f& point, CoordSys coordSys = CoordSys_Global);
|
||||
void AddImpulse(const Vector2f& impulse, CoordSys coordSys = CoordSys_Global);
|
||||
void AddImpulse(const Vector2f& impulse, const Vector2f& point, CoordSys coordSys = CoordSys_Global);
|
||||
void AddTorque(float torque);
|
||||
void AddTorque(const RadianAnglef& torque);
|
||||
|
||||
bool ClosestPointQuery(const Nz::Vector2f& position, Nz::Vector2f* closestPoint = nullptr, float* closestDistance = nullptr) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
void RigidBody2D::AddTorque(float torque)
|
||||
void RigidBody2D::AddTorque(const RadianAnglef& torque)
|
||||
{
|
||||
cpBodySetTorque(m_handle, cpBodyGetTorque(m_handle) + ToRadians(torque));
|
||||
cpBodySetTorque(m_handle, cpBodyGetTorque(m_handle) + torque.value);
|
||||
}
|
||||
|
||||
bool RigidBody2D::ClosestPointQuery(const Nz::Vector2f& position, Nz::Vector2f* closestPoint, float* closestDistance) const
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]")
|
|||
|
||||
WHEN("We apply a torque")
|
||||
{
|
||||
body.AddTorque(Nz::DegreeToRadian(90.f));
|
||||
body.AddTorque(Nz::DegreeAnglef(90.f));
|
||||
world.Step(1.f);
|
||||
|
||||
THEN("It is also counter-clockwise")
|
||||
|
|
|
|||
Loading…
Reference in New Issue