Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は 1 つの物理ベースのゲームを作成しています。この画像に見られるように、私は 1 つのタンクを持っています。頭が回転するので、戦車の頭の現在の角度の方向にボールを発射したいです。このボディに力を加えて、タンクのヘッドの方向に移動できるようにするにはどうすればよいですか?
body->SetActive(true); float magnitude=800; b2Vec2 force = b2Vec2((cos(body->GetAngle()-4.7) * magnitude) , (sin(body->GetAngle()-4.7) * magnitude)); body->ApplyLinearImpulse(force, body->GetPosition());