Physics2D/RigidBody2D: Remove gravity factor
This commit is contained in:
parent
f18a84810f
commit
438d8e918c
|
|
@ -39,7 +39,6 @@ namespace Nz
|
||||||
float GetAngularVelocity() const;
|
float GetAngularVelocity() const;
|
||||||
Vector2f GetCenterOfGravity(CoordSys coordSys = CoordSys_Local) const;
|
Vector2f GetCenterOfGravity(CoordSys coordSys = CoordSys_Local) const;
|
||||||
const Collider2DRef& GetGeom() const;
|
const Collider2DRef& GetGeom() const;
|
||||||
float GetGravityFactor() const;
|
|
||||||
cpBody* GetHandle() const;
|
cpBody* GetHandle() const;
|
||||||
float GetMass() const;
|
float GetMass() const;
|
||||||
Vector2f GetPosition() const;
|
Vector2f GetPosition() const;
|
||||||
|
|
@ -50,7 +49,6 @@ namespace Nz
|
||||||
bool IsSleeping() const;
|
bool IsSleeping() const;
|
||||||
|
|
||||||
void SetAngularVelocity(float angularVelocity);
|
void SetAngularVelocity(float angularVelocity);
|
||||||
void SetGravityFactor(float gravityFactor);
|
|
||||||
void SetMass(float mass);
|
void SetMass(float mass);
|
||||||
void SetMassCenter(const Vector2f& center);
|
void SetMassCenter(const Vector2f& center);
|
||||||
void SetPosition(const Vector2f& position);
|
void SetPosition(const Vector2f& position);
|
||||||
|
|
|
||||||
|
|
@ -97,12 +97,12 @@ namespace Nz
|
||||||
for (cpShape* shape : m_shapes)
|
for (cpShape* shape : m_shapes)
|
||||||
bb = cpBBMerge(bb, cpShapeGetBB(shape));
|
bb = cpBBMerge(bb, cpShapeGetBB(shape));
|
||||||
|
|
||||||
return Rectf(bb.l, bb.t, bb.r - bb.l, bb.b - bb.t);
|
return Rectf(Rect<cpFloat>(bb.l, bb.t, bb.r - bb.l, bb.b - bb.t));
|
||||||
}
|
}
|
||||||
|
|
||||||
float RigidBody2D::GetAngularVelocity() const
|
float RigidBody2D::GetAngularVelocity() const
|
||||||
{
|
{
|
||||||
return cpBodyGetAngularVelocity(m_handle);
|
return static_cast<float>(cpBodyGetAngularVelocity(m_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
const Collider2DRef& RigidBody2D::GetGeom() const
|
const Collider2DRef& RigidBody2D::GetGeom() const
|
||||||
|
|
@ -110,11 +110,6 @@ namespace Nz
|
||||||
return m_geom;
|
return m_geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
float RigidBody2D::GetGravityFactor() const
|
|
||||||
{
|
|
||||||
return m_gravityFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpBody* RigidBody2D::GetHandle() const
|
cpBody* RigidBody2D::GetHandle() const
|
||||||
{
|
{
|
||||||
return m_handle;
|
return m_handle;
|
||||||
|
|
@ -139,24 +134,24 @@ namespace Nz
|
||||||
break; // Nothing to do
|
break; // Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vector2f(cog.x, cog.y);
|
return Vector2f(static_cast<float>(cog.x), static_cast<float>(cog.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2f RigidBody2D::GetPosition() const
|
Vector2f RigidBody2D::GetPosition() const
|
||||||
{
|
{
|
||||||
cpVect pos = cpBodyGetPosition(m_handle);
|
cpVect pos = cpBodyGetPosition(m_handle);
|
||||||
return Vector2f(pos.x, pos.y);
|
return Vector2f(static_cast<float>(pos.x), static_cast<float>(pos.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
float RigidBody2D::GetRotation() const
|
float RigidBody2D::GetRotation() const
|
||||||
{
|
{
|
||||||
return cpBodyGetAngle(m_handle);
|
return static_cast<float>(cpBodyGetAngle(m_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2f RigidBody2D::GetVelocity() const
|
Vector2f RigidBody2D::GetVelocity() const
|
||||||
{
|
{
|
||||||
cpVect vel = cpBodyGetVelocity(m_handle);
|
cpVect vel = cpBodyGetVelocity(m_handle);
|
||||||
return Vector2f(vel.x, vel.y);
|
return Vector2f(static_cast<float>(vel.x), static_cast<float>(vel.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RigidBody2D::IsMoveable() const
|
bool RigidBody2D::IsMoveable() const
|
||||||
|
|
@ -174,11 +169,6 @@ namespace Nz
|
||||||
cpBodySetAngularVelocity(m_handle, angularVelocity);
|
cpBodySetAngularVelocity(m_handle, angularVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RigidBody2D::SetGravityFactor(float gravityFactor)
|
|
||||||
{
|
|
||||||
m_gravityFactor = gravityFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RigidBody2D::SetMass(float mass)
|
void RigidBody2D::SetMass(float mass)
|
||||||
{
|
{
|
||||||
if (m_mass > 0.f)
|
if (m_mass > 0.f)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue