How would you go about creating a 'predictive path line' in a golf game?

I’m using ue 4.26.1

Hi!
I’m working on a small golf game for fun.
I want to include a feature that, while aiming, let’s you see the path that your ball will take after being hit, as well as where it will land. It’s a pretty standard feature in golf games, but I’m not sure how to implement it.

1 Like

Unreal nowadays has a node called Predict Projectile Path.

2 Likes

Thanks! That helped. I wasn’t aware of that node

Funny you should ask this question, this was going to be my next learning project. A fan of Pangya maybe? :stuck_out_tongue:

1 Like

I am a fan… Is there a way to simulate physics in the background, or simulate it before playing?

Pangya calculates all the results of a shot at the moment you define the power and direction of the shot.
It sends to another client to calculate the physics and take the result back to show the player the animation of the shot.

Besides this technical network approach, how can I run the physics of the ball without showing the player, and after the simulation is done, I playback it to him?

I think Pangya does the calculations server-side and sends back a vector with speed/direction of the ball at every node.

O---------O-----------0--------------- 0 -----------0-----------E
Start ----xyz/rotation | next xyz/rot…End xyz/loc

Client and Sever map would be 100% identical so it should always work.

To be perfectly honest, that’s only how I imagine it working. Since Pangya is no longer a game that is in service, people rely on private servers to play it. This being said, I don’t know if there’s source code available for the game to look at. But this is my best guess.