Exemple #1
0
static int l_physics_getBodyTorque(lua_State* state)
{
    l_tools_checkUserDataPlusErrMsg(state, 1, "You must provide a body");
    l_physics_Body* body = (l_physics_Body*)lua_touserdata(state, 1);

    lua_pushnumber(state, cpBodyGetTorque(body->body));

    return 1;
}
	void RigidBody2D::CopyBodyData(cpBody* body)
	{
		cpBodySetAngle(m_handle, cpBodyGetAngle(body));
		cpBodySetAngularVelocity(m_handle, cpBodyGetAngularVelocity(body));
		cpBodySetCenterOfGravity(m_handle, cpBodyGetCenterOfGravity(body));
		cpBodySetForce(m_handle, cpBodyGetForce(body));
		cpBodySetPosition(m_handle, cpBodyGetPosition(body));
		cpBodySetTorque(m_handle, cpBodyGetTorque(body));
		cpBodySetVelocity(m_handle, cpBodyGetVelocity(body));
	}
	void RigidBody2D::CopyBodyData(cpBody* from, cpBody* to)
	{
		cpBodySetAngle(to, cpBodyGetAngle(from));
		cpBodySetAngularVelocity(to, cpBodyGetAngularVelocity(from));
		cpBodySetCenterOfGravity(to, cpBodyGetCenterOfGravity(from));
		cpBodySetForce(to, cpBodyGetForce(from));
		cpBodySetPosition(to, cpBodyGetPosition(from));
		cpBodySetTorque(to, cpBodyGetTorque(from));
		cpBodySetVelocity(to, cpBodyGetVelocity(from));
	}
Exemple #4
0
cpFloat cBody::Torque() const {
	return cpBodyGetTorque( mBody );
}
	void RigidBody2D::AddTorque(float torque)
	{
		cpBodySetTorque(m_handle, cpBodyGetTorque(m_handle) + ToRadians(torque));
	}
	void RigidBody2D::AddTorque(const RadianAnglef& torque)
	{
		cpBodySetTorque(m_handle, cpBodyGetTorque(m_handle) + torque.value);
	}
Exemple #7
0
Scalar physics_get_torque(Entity ent)
{
    PhysicsInfo *info = entitypool_get(pool, ent);
    error_assert(info);
    return cpBodyGetTorque(info->body);
}
Exemple #8
0
cpFloat Body::getTorque(void)
{
		return cpBodyGetTorque(body);
}