Physics3D/RigidBody3D: Rename [Get|Set]Velocity to [Get|Set]LinearVelocity

This commit is contained in:
Lynix
2017-12-10 12:09:36 +01:00
parent 37bbdfb34b
commit 0df70dcb16
6 changed files with 49 additions and 48 deletions

View File

@@ -34,12 +34,12 @@ namespace Ndk
Nz::Vector3f GetAngularVelocity() const;
float GetGravityFactor() const;
float GetLinearDamping() const;
Nz::Vector3f GetLinearVelocity() const;
float GetMass() const;
Nz::Vector3f GetMassCenter(Nz::CoordSys coordSys = Nz::CoordSys_Local) const;
const Nz::Matrix4f& GetMatrix() const;
Nz::Vector3f GetPosition() const;
Nz::Quaternionf GetRotation() const;
Nz::Vector3f GetVelocity() const;
bool IsAutoSleepEnabled() const;
bool IsMoveable() const;
@@ -49,11 +49,11 @@ namespace Ndk
void SetAngularVelocity(const Nz::Vector3f& angularVelocity);
void SetGravityFactor(float gravityFactor);
void SetLinearDamping(float damping);
void SetLinearVelocity(const Nz::Vector3f& velocity);
void SetMass(float mass);
void SetMassCenter(const Nz::Vector3f& center);
void SetPosition(const Nz::Vector3f& position);
void SetRotation(const Nz::Quaternionf& rotation);
void SetVelocity(const Nz::Vector3f& velocity);
static ComponentIndex componentIndex;

View File

@@ -146,6 +146,20 @@ namespace Ndk
return m_object->GetLinearDamping();
}
/*!
* \brief Gets the linear velocity of the physics object
* \return Linear velocity of the object
*
* \remark Produces a NazaraAssert if the physics object is invalid
*/
inline Nz::Vector3f PhysicsComponent3D::GetLinearVelocity() const
{
NazaraAssert(m_object, "Invalid physics object");
return m_object->GetLinearVelocity();
}
/*!
* \brief Gets the mass of the physics object
* \return Mass of the object
@@ -218,20 +232,6 @@ namespace Ndk
return m_object->GetRotation();
}
/*!
* \brief Gets the velocity of the physics object
* \return Velocity of the object
*
* \remark Produces a NazaraAssert if the physics object is invalid
*/
inline Nz::Vector3f PhysicsComponent3D::GetVelocity() const
{
NazaraAssert(m_object, "Invalid physics object");
return m_object->GetVelocity();
}
/*!
* \brief Checks whether the auto sleep is enabled
* \return true If it is the case
@@ -328,6 +328,20 @@ namespace Ndk
m_object->SetLinearDamping(damping);
}
/*!
* \brief Sets the linear velocity of the physics object
*
* \param velocity New linear velocity of the object
*
* \remark Produces a NazaraAssert if the physics object is invalid
*/
inline void PhysicsComponent3D::SetLinearVelocity(const Nz::Vector3f& velocity)
{
NazaraAssert(m_object, "Invalid physics object");
m_object->SetLinearVelocity(velocity);
}
/*!
* \brief Sets the mass of the physics object
*
@@ -389,21 +403,6 @@ namespace Ndk
m_object->SetRotation(rotation);
}
/*!
* \brief Sets the velocity of the physics object
*
* \param velocity Velocity of the object
*
* \remark Produces a NazaraAssert if the physics object is invalid
*/
inline void PhysicsComponent3D::SetVelocity(const Nz::Vector3f& velocity)
{
NazaraAssert(m_object, "Invalid physics object");
m_object->SetVelocity(velocity);
}
/*!
* \brief Gets the underlying physics object
* \return A reference to the physics object

View File

@@ -103,10 +103,10 @@ namespace Ndk
if (newPosition != oldPosition)
{
physObj->SetPosition(newPosition);
physObj->SetVelocity((newPosition - oldPosition) * invElapsedTime);
physObj->SetLinearVelocity((newPosition - oldPosition) * invElapsedTime);
}
else
physObj->SetVelocity(Nz::Vector3f::Zero());
physObj->SetLinearVelocity(Nz::Vector3f::Zero());
if (newRotation != oldRotation)
{