How do I calculate thrust for a ball to reach the target
From the ball to the target is 262.15, pixels, or units, I subtracted the two z parts of position.
This is my code:
void FixedUpdate()
{
ball.useGravity = true;
float f = thrust/2;
ball.AddForce(new Vector3(100* Time.fixedDeltaTime,600* Time.fixedDeltaTime, -thrust* Time.fixedDeltaTime));
ball.AddForce(Vector3.down * 10f * Time.fixedDeltaTime);
}
I arbitrarily picked 600 and 100, just so it could move to one side of the target.
My mass is 1, drag is 1, angular drag 0.05
I want to have an equation so I can pick a point, move the ball back and forward, and have the user try to catch the ball, but it can't go too hard.
Also, my ball doesn't go up and down as I expected with gravity, which is why I added a down force.
I think the first ball.AddForce should be done one time and just let it go, but putting this in Update
isn't working either.
I want it to go up and down as a ball should, and be able to pick where it will actually come down at.
Your answer
Follow this Question
Related Questions
How do I create a naturally swaying sequence of physics bones for a character? 0 Answers
I would like to better understand the physics of wheel colliders. 0 Answers
Rolling a ball when game starts 0 Answers
I'm trying to make the collision work. But... 2 Answers
Change Physics2D.maxTranslationSpeed at runtime does not work 0 Answers