void ETHPhysicsEntityController::Update(const float lastFrameElapsedTime, ETHBucketManager& buckets)
{
	if (!m_body)
		return;

	if (!m_body->IsActive())
		return;

	GS2D_UNUSED_ARGUMENT(lastFrameElapsedTime);
	const Vector2 pos = ETHPhysicsSimulator::ScaleFromBox2D(m_body->GetPosition());
	const Vector2 oldPos = Vector2(m_pos.x, m_pos.y);
	if (oldPos != pos)
	{
		m_pos = Vector3(pos, GetPos().z);
		buckets.RequestBucketMove(static_cast<ETHEntity*>(m_body->GetUserData()), oldPos, pos);
	}
	m_angle =-RadianToDegree(m_body->GetAngle());
}
Exemple #2
0
void ETHEntity::AddToPositionY(const float v, ETHBucketManager& buckets)
{
	const Vector2& oldPos(GetPositionXY());
	m_controller->AddToPosY(v);
	buckets.RequestBucketMove(this, oldPos, GetPositionXY());
}
Exemple #3
0
void ETHEntity::SetPositionXY(const Vector2& pos, ETHBucketManager& buckets)
{
	const Vector2& oldPos(GetPositionXY());
	m_controller->SetPosXY(pos);
	buckets.RequestBucketMove(this, oldPos, GetPositionXY());
}