cocs2dx で box2d ボディの発射体モーションを実装する方法....
newX = b4->GetPosition().x + cos(60.0);
newY = b4->GetPosition().y + sin(60.0);
これは正しい方法ですか?
cocs2dx で box2d ボディの発射体モーションを実装する方法....
newX = b4->GetPosition().x + cos(60.0);
newY = b4->GetPosition().y + sin(60.0);
これは正しい方法ですか?
オブジェクトの初期速度、角度、重力= 9.81、および時間がゼロから開始するようにすることができます。
while(count < 10)
{
// this is formula for trajectory
// http://en.wikipedia.org/wiki/Projectile_motion
x = initialVelocity * time * Math.Cos(angle);
y = initialVelocity * time * Math.Sin(angle) - 0.5f * gravity * time * time;
count++;
time += 0.1f;
}