- Home /
How to calculate future movement like in golf games?
What's the best way to calculate future movement like seen on the picture. I'm using Rigidbody
Answer by Statement · Dec 21, 2019 at 02:04 PM
Not going to claim that this is the best way, but one way to do it would be using SphereCast and simulate the balls movement by iterating motion, collision and response over n seconds in a tight loop that runs in 1 frame.
Sorry for short and vague answer.
Oh would it be outlandish to calculate using the rigidbody? Since I need to predict the player's next few frames and it's affected by forces and gravity. Would it be possible to run player's movement using FixedUpdate but also for the next few frames? That's kind of what I'm puzzling about :)
You could try using a ghost rigidbody though IIRC physics calculations aren't guaranteed to perform the same between runs so you might get a few shots that won't follow the ghost.
The only way to use a rigidbody would be to have a duplicate physics scene, with the exact same setup, and run it by hand.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220453im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sometimes the ball isn't moving 0 Answers
RigidBody.MovePosition seems jerky in movement 0 Answers
changing the speed of an enemy on key press? 2 Answers
Keep Horizontal Momentum after Jump 2 Answers
Player getting stuck in ground (3D) player has Rigidbody, and Box Collider, world is Mesh Colliders 0 Answers