Physics3D/RigidBody3D: Rename [Get|Set]Velocity to [Get|Set]LinearVelocity
This commit is contained in:
parent
37bbdfb34b
commit
0df70dcb16
|
|
@ -35,6 +35,7 @@ Nazara Engine:
|
||||||
- Fix default directory permission (now created with 777)
|
- Fix default directory permission (now created with 777)
|
||||||
- Add linear and angular damping accessor to RigidBody3D
|
- Add linear and angular damping accessor to RigidBody3D
|
||||||
- Fix MemoryStream::WriteBlock "Invalid buffer" assertion triggering when writing a zero-sized block
|
- Fix MemoryStream::WriteBlock "Invalid buffer" assertion triggering when writing a zero-sized block
|
||||||
|
- ⚠️ Rename RigidBody3D::[Get|Set]Velocity to [Get|Set]LinearVelocity
|
||||||
|
|
||||||
Nazara Development Kit:
|
Nazara Development Kit:
|
||||||
- Added ImageWidget (#139)
|
- Added ImageWidget (#139)
|
||||||
|
|
@ -59,6 +60,7 @@ Nazara Development Kit:
|
||||||
- Fix GraphicsComponent::Clear method now clearing reflective states
|
- Fix GraphicsComponent::Clear method now clearing reflective states
|
||||||
- Add linear and angular damping accessor to PhysicsComponent3D
|
- Add linear and angular damping accessor to PhysicsComponent3D
|
||||||
- Fix GraphicsComponent cloning not copying renderable local matrices
|
- Fix GraphicsComponent cloning not copying renderable local matrices
|
||||||
|
- ⚠️ Rename PhysicsComponent3D::[Get|Set]Velocity to [Get|Set]LinearVelocity
|
||||||
|
|
||||||
# 0.4:
|
# 0.4:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ namespace Ndk
|
||||||
Nz::Vector3f GetAngularVelocity() const;
|
Nz::Vector3f GetAngularVelocity() const;
|
||||||
float GetGravityFactor() const;
|
float GetGravityFactor() const;
|
||||||
float GetLinearDamping() const;
|
float GetLinearDamping() const;
|
||||||
|
Nz::Vector3f GetLinearVelocity() const;
|
||||||
float GetMass() const;
|
float GetMass() const;
|
||||||
Nz::Vector3f GetMassCenter(Nz::CoordSys coordSys = Nz::CoordSys_Local) const;
|
Nz::Vector3f GetMassCenter(Nz::CoordSys coordSys = Nz::CoordSys_Local) const;
|
||||||
const Nz::Matrix4f& GetMatrix() const;
|
const Nz::Matrix4f& GetMatrix() const;
|
||||||
Nz::Vector3f GetPosition() const;
|
Nz::Vector3f GetPosition() const;
|
||||||
Nz::Quaternionf GetRotation() const;
|
Nz::Quaternionf GetRotation() const;
|
||||||
Nz::Vector3f GetVelocity() const;
|
|
||||||
|
|
||||||
bool IsAutoSleepEnabled() const;
|
bool IsAutoSleepEnabled() const;
|
||||||
bool IsMoveable() const;
|
bool IsMoveable() const;
|
||||||
|
|
@ -49,11 +49,11 @@ namespace Ndk
|
||||||
void SetAngularVelocity(const Nz::Vector3f& angularVelocity);
|
void SetAngularVelocity(const Nz::Vector3f& angularVelocity);
|
||||||
void SetGravityFactor(float gravityFactor);
|
void SetGravityFactor(float gravityFactor);
|
||||||
void SetLinearDamping(float damping);
|
void SetLinearDamping(float damping);
|
||||||
|
void SetLinearVelocity(const Nz::Vector3f& velocity);
|
||||||
void SetMass(float mass);
|
void SetMass(float mass);
|
||||||
void SetMassCenter(const Nz::Vector3f& center);
|
void SetMassCenter(const Nz::Vector3f& center);
|
||||||
void SetPosition(const Nz::Vector3f& position);
|
void SetPosition(const Nz::Vector3f& position);
|
||||||
void SetRotation(const Nz::Quaternionf& rotation);
|
void SetRotation(const Nz::Quaternionf& rotation);
|
||||||
void SetVelocity(const Nz::Vector3f& velocity);
|
|
||||||
|
|
||||||
static ComponentIndex componentIndex;
|
static ComponentIndex componentIndex;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,20 @@ namespace Ndk
|
||||||
return m_object->GetLinearDamping();
|
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
|
* \brief Gets the mass of the physics object
|
||||||
* \return Mass of the object
|
* \return Mass of the object
|
||||||
|
|
@ -218,20 +232,6 @@ namespace Ndk
|
||||||
return m_object->GetRotation();
|
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
|
* \brief Checks whether the auto sleep is enabled
|
||||||
* \return true If it is the case
|
* \return true If it is the case
|
||||||
|
|
@ -328,6 +328,20 @@ namespace Ndk
|
||||||
m_object->SetLinearDamping(damping);
|
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
|
* \brief Sets the mass of the physics object
|
||||||
*
|
*
|
||||||
|
|
@ -389,21 +403,6 @@ namespace Ndk
|
||||||
m_object->SetRotation(rotation);
|
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
|
* \brief Gets the underlying physics object
|
||||||
* \return A reference to the physics object
|
* \return A reference to the physics object
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,10 @@ namespace Ndk
|
||||||
if (newPosition != oldPosition)
|
if (newPosition != oldPosition)
|
||||||
{
|
{
|
||||||
physObj->SetPosition(newPosition);
|
physObj->SetPosition(newPosition);
|
||||||
physObj->SetVelocity((newPosition - oldPosition) * invElapsedTime);
|
physObj->SetLinearVelocity((newPosition - oldPosition) * invElapsedTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
physObj->SetVelocity(Nz::Vector3f::Zero());
|
physObj->SetLinearVelocity(Nz::Vector3f::Zero());
|
||||||
|
|
||||||
if (newRotation != oldRotation)
|
if (newRotation != oldRotation)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,12 @@ namespace Nz
|
||||||
float GetGravityFactor() const;
|
float GetGravityFactor() const;
|
||||||
NewtonBody* GetHandle() const;
|
NewtonBody* GetHandle() const;
|
||||||
float GetLinearDamping() const;
|
float GetLinearDamping() const;
|
||||||
|
Vector3f GetLinearVelocity() const;
|
||||||
float GetMass() const;
|
float GetMass() const;
|
||||||
Vector3f GetMassCenter(CoordSys coordSys = CoordSys_Local) const;
|
Vector3f GetMassCenter(CoordSys coordSys = CoordSys_Local) const;
|
||||||
const Matrix4f& GetMatrix() const;
|
const Matrix4f& GetMatrix() const;
|
||||||
Vector3f GetPosition() const;
|
Vector3f GetPosition() const;
|
||||||
Quaternionf GetRotation() const;
|
Quaternionf GetRotation() const;
|
||||||
Vector3f GetVelocity() const;
|
|
||||||
PhysWorld3D* GetWorld() const;
|
PhysWorld3D* GetWorld() const;
|
||||||
|
|
||||||
bool IsAutoSleepEnabled() const;
|
bool IsAutoSleepEnabled() const;
|
||||||
|
|
@ -60,11 +60,11 @@ namespace Nz
|
||||||
void SetGeom(Collider3DRef geom);
|
void SetGeom(Collider3DRef geom);
|
||||||
void SetGravityFactor(float gravityFactor);
|
void SetGravityFactor(float gravityFactor);
|
||||||
void SetLinearDamping(float damping);
|
void SetLinearDamping(float damping);
|
||||||
|
void SetLinearVelocity(const Vector3f& velocity);
|
||||||
void SetMass(float mass);
|
void SetMass(float mass);
|
||||||
void SetMassCenter(const Vector3f& center);
|
void SetMassCenter(const Vector3f& center);
|
||||||
void SetPosition(const Vector3f& position);
|
void SetPosition(const Vector3f& position);
|
||||||
void SetRotation(const Quaternionf& rotation);
|
void SetRotation(const Quaternionf& rotation);
|
||||||
void SetVelocity(const Vector3f& velocity);
|
|
||||||
|
|
||||||
RigidBody3D& operator=(const RigidBody3D& object);
|
RigidBody3D& operator=(const RigidBody3D& object);
|
||||||
RigidBody3D& operator=(RigidBody3D&& object);
|
RigidBody3D& operator=(RigidBody3D&& object);
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,14 @@ namespace Nz
|
||||||
return NewtonBodyGetLinearDamping(m_body);
|
return NewtonBodyGetLinearDamping(m_body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector3f RigidBody3D::GetLinearVelocity() const
|
||||||
|
{
|
||||||
|
Vector3f velocity;
|
||||||
|
NewtonBodyGetVelocity(m_body, velocity);
|
||||||
|
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
|
||||||
float RigidBody3D::GetMass() const
|
float RigidBody3D::GetMass() const
|
||||||
{
|
{
|
||||||
return m_mass;
|
return m_mass;
|
||||||
|
|
@ -207,14 +215,6 @@ namespace Nz
|
||||||
return m_matrix.GetRotation();
|
return m_matrix.GetRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3f RigidBody3D::GetVelocity() const
|
|
||||||
{
|
|
||||||
Vector3f velocity;
|
|
||||||
NewtonBodyGetVelocity(m_body, velocity);
|
|
||||||
|
|
||||||
return velocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysWorld3D* RigidBody3D::GetWorld() const
|
PhysWorld3D* RigidBody3D::GetWorld() const
|
||||||
{
|
{
|
||||||
return m_world;
|
return m_world;
|
||||||
|
|
@ -268,6 +268,11 @@ namespace Nz
|
||||||
NewtonBodySetLinearDamping(m_body, damping);
|
NewtonBodySetLinearDamping(m_body, damping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RigidBody3D::SetLinearVelocity(const Vector3f& velocity)
|
||||||
|
{
|
||||||
|
NewtonBodySetVelocity(m_body, velocity);
|
||||||
|
}
|
||||||
|
|
||||||
void RigidBody3D::SetMass(float mass)
|
void RigidBody3D::SetMass(float mass)
|
||||||
{
|
{
|
||||||
if (m_mass > 0.f)
|
if (m_mass > 0.f)
|
||||||
|
|
@ -313,11 +318,6 @@ namespace Nz
|
||||||
UpdateBody();
|
UpdateBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RigidBody3D::SetVelocity(const Vector3f& velocity)
|
|
||||||
{
|
|
||||||
NewtonBodySetVelocity(m_body, velocity);
|
|
||||||
}
|
|
||||||
|
|
||||||
RigidBody3D& RigidBody3D::operator=(const RigidBody3D& object)
|
RigidBody3D& RigidBody3D::operator=(const RigidBody3D& object)
|
||||||
{
|
{
|
||||||
RigidBody3D physObj(object);
|
RigidBody3D physObj(object);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue