public void interpolate(float alpha) { for (Box box : activeBoxes) { Body body = box.getBody(); if(body.isActive()) { Transform transform = body.getTransform(); Vector2 bodyPosition = transform.getPosition(); float bodyAngle = transform.getRotation(); box.x = bodyPosition.x * alpha + box.x * (1.0f - alpha); box.y = bodyPosition.y * alpha + box.y * (1.0f - alpha); box.angle = bodyAngle * alpha + box.angle * (1.0f - alpha); } } }
box.x = bodyPosition.x; box.y = bodyPosition.y; box.angle = bodyTransform.getRotation();