I want to make a ball that bounces back from walls and hurdles but doesn't bounce in Y-axis. Is it possible I am currently applying force whenever the ball leaves the ground but it is not giving a realistic effect
Asked
Active
Viewed 141 times
-2
-
Please show us the code of what you are trying so far – derHugo Oct 02 '18 at 15:41
-
Are you using Physic materials? – AresCaelum Oct 02 '18 at 19:37
-
Yes, but I have kept the bounce to 0.6 – SAmi Shiekh Oct 03 '18 at 07:05
1 Answers
0
I thought there were checkboxes in the inspector to lock an axis... either way, you could cache the previous Y value in fixedUpdate() as "lockedY", and if the current Y axis value is higher, just reapply the cached one, I think.
-
I tried this too but this stops the ball from moving on an uneven surface as the Y-axis is locked. My environment is an uneven ground full of mud and obstacles – SAmi Shiekh Oct 02 '18 at 10:15