Physics2D/RigidBody2D: Temporary remove SetGeom to fix a linking error

This commit is contained in:
Lynix 2016-10-14 18:01:24 +02:00
parent 119436a642
commit f3e041c4c0
2 changed files with 11 additions and 20 deletions

View File

@ -50,7 +50,6 @@ namespace Nz
bool IsSleeping() const; bool IsSleeping() const;
void SetAngularVelocity(float angularVelocity); void SetAngularVelocity(float angularVelocity);
void SetGeom(Collider2DRef geom);
void SetGravityFactor(float gravityFactor); void SetGravityFactor(float gravityFactor);
void SetMass(float mass); void SetMass(float mass);
void SetMassCenter(const Vector2f& center); void SetMassCenter(const Vector2f& center);
@ -63,6 +62,7 @@ namespace Nz
private: private:
void Destroy(); void Destroy();
void SetGeom(Collider2DRef geom);
std::vector<cpShape*> m_shapes; std::vector<cpShape*> m_shapes;
Collider2DRef m_geom; Collider2DRef m_geom;

View File

@ -174,25 +174,6 @@ namespace Nz
cpBodySetAngularVelocity(m_handle, angularVelocity); cpBodySetAngularVelocity(m_handle, angularVelocity);
} }
void RigidBody2D::SetGeom(Collider2DRef geom)
{
if (m_geom.Get() != geom)
{
for (cpShape* shape : m_shapes)
{
cpBodyRemoveShape(m_handle, shape);
cpShapeFree(shape);
}
if (geom)
m_geom = geom;
else
m_geom = NullCollider2D::New();
m_shapes = m_geom->CreateShapes(this);
}
}
void RigidBody2D::SetGravityFactor(float gravityFactor) void RigidBody2D::SetGravityFactor(float gravityFactor)
{ {
m_gravityFactor = gravityFactor; m_gravityFactor = gravityFactor;
@ -267,4 +248,14 @@ namespace Nz
if (m_handle) if (m_handle)
cpBodyFree(m_handle); cpBodyFree(m_handle);
} }
void RigidBody2D::SetGeom(Collider2DRef geom)
{
if (geom)
m_geom = geom;
else
m_geom = NullCollider2D::New();
m_shapes = m_geom->CreateShapes(this);
}
} }