0
나는이 차량의 움직임을 좀 더 현실감있게 보이려하고있다.스프라이트의 회전 지연
이것은 회전의 순간을 제외하고는 완벽하게 작동합니다.
즉시 할 수 있습니다. 나는 너무 빨리 돌아 다니기를 원하지 않는다.
public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, final float pValueX, final float pValueY) {
final Body carBody = CityRacerActivity.this.mCarBody;
final float rotationInRad = (float)Math.atan2(-pValueX, pValueY);
if ((pValueX == 0) && (pValueY == 0)) {
//Don't turn the body/sprite of the car
}else {
carBody.setTransform(carBody.getWorldCenter(), rotationInRad);
//turn the car body in the direction of movement
CityRacerActivity.this.mCar.setRotation(MathUtils.radToDeg(rotationInRad));
}
//set the velocity
final Vector2 velocity = Vector2Pool.obtain(pValueX * 5, pValueY * 5);
carBody.setLinearVelocity(velocity);
Vector2Pool.recycle(velocity);
}
차를 운전하는 것처럼 더 많은 놀이를하고 싶습니다.
어디에서이 메서드를 호출합니까? –
이 메소드는 andengine의 일부로 사용됩니다. 터치 스크린에 디지털 조이스틱을 만듭니다. –