RigidBody2D: Add experimental SetMomentOfInertia method
This commit is contained in:
@@ -57,6 +57,7 @@ namespace Nz
|
|||||||
void SetGeom(Collider2DRef geom);
|
void SetGeom(Collider2DRef geom);
|
||||||
void SetMass(float mass);
|
void SetMass(float mass);
|
||||||
void SetMassCenter(const Vector2f& center);
|
void SetMassCenter(const Vector2f& center);
|
||||||
|
void SetMomentOfInertia(float moment);
|
||||||
void SetPosition(const Vector2f& position);
|
void SetPosition(const Vector2f& position);
|
||||||
void SetRotation(float rotation);
|
void SetRotation(float rotation);
|
||||||
void SetUserdata(void* ud);
|
void SetUserdata(void* ud);
|
||||||
|
|||||||
@@ -285,6 +285,14 @@ namespace Nz
|
|||||||
cpBodySetCenterOfGravity(m_handle, cpv(center.x, center.y));
|
cpBodySetCenterOfGravity(m_handle, cpv(center.x, center.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RigidBody2D::SetMomentOfInertia(float moment)
|
||||||
|
{
|
||||||
|
m_world->RegisterPostStep(this, [moment] (Nz::RigidBody2D* body)
|
||||||
|
{
|
||||||
|
cpBodySetMoment(body->GetHandle(), moment);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void RigidBody2D::SetPosition(const Vector2f& position)
|
void RigidBody2D::SetPosition(const Vector2f& position)
|
||||||
{
|
{
|
||||||
cpBodySetPosition(m_handle, cpv(position.x, position.y));
|
cpBodySetPosition(m_handle, cpv(position.x, position.y));
|
||||||
|
|||||||
Reference in New Issue
Block a user