Hello!
I am making a Golf game in JMonkey 3 Engine. I am not using the physics of this engine because I want to do it myself.
What I have at the moment:
Can shoot the ball over a terrain, collision detection with trees and walls ( with appropriate reactions ).
But now I am running into some trouble when trying to implement slopes/hills. (see picture)
When the ball is on the slope, I check whether it is going up ( then I decrease the velocity of the ball) or going down ( then I increase the velocity of the ball). Also if the ball is going uphill and it comes to a stop, I multiply the x and y velocity by -1 and i add some speed, so it comes back rolling again. But herein lies the problem. This only looks realistic when I shoot the ball straight up the hill, because only then does the ball roll down realistically ( because it rolls down the same path it went up).
But ofcourse I want it also to work when I shoot the ball at an angle up the hill. I have done a lot of googling on this, but I can't really find an explanation anywhere. So I thought I'd ask it here.
Do you guys have any idea how to do this?