Hello
A bit of background first. I have this project of a game that teaches physics ( or at least is helping to).
In first experiment, player needs to move cannon to specific location by recoil (shooting cannonball).
Player can choose mass of cannonball and the muzzle velocity.
And here is the question: How to calculate the final position that cannon will be at when force is applied? Cannon only moves back horizontally.
Because i want player to actually be able to calculate what cannonball to use and what muzzle velocity should be, without guessing.
The whole experiment works btw.
Here how it looks in game:
Cannon:

And here is relevant code:
private void StartTest()
{
if(cannonballItem == null) { return; }
ballRB.mass = cannonballItem.Mass;
velocityBall = float.Parse(velocityBallText.text);
force = ballRB.mass * velocityBall;
ballForce = new Vector3(0f, 0f, force);
cannonForce = new Vector3(0f, 0f, -force);
ball.transform.localPosition = visiblePosOfBall;
ballRB.useGravity = true;
ballCollider.enabled = true;
ballRB.AddForce(ballForce, ForceMode.Impulse);
cannonRB.AddForce(cannonForce, ForceMode.Impulse);
testEnded = true;
cannonUseItemHandler.CanRetriveItems = false;
}
