- Home /
Smooth Player Ball Rolling
I was trying to achieve this kind of player ball movement: Catch Up (Ketchapp)
From my side I have tried and record a video of my current implementation: CatchUpBallMovementDemoVideo
Two kinds of problem, I was facing:
ball making so much jerk while moving on the plain track that I hope you have clearly noticed in my recorded video
when ball reach left or right edge and you try to swipe its making jerk again rather than remain restricted because clamping related code already added
I have just created a demo project so here I am providing the link for it so personally you can check and provide me a suggestion for making ball movement perfect.
Demo Project Source Link: CatchUpBallDemoProject Demo Project SIZE 20MB
What at present making jerk in ball movement that I can't able to decide, whether its following camera jerk, whether ball not moving properly though I have created a plain track for checking purpose.
Ball Inspector Detail:
Complete code added within the working demo project. Share your suggestions with me to solve this.
Answer by CDAXRC · Oct 19, 2018 at 04:53 PM
Try this
public float degree; //roll direction public float forceMultiplier; float radians = degree * Mathf.Deg2Rad; float xVelocity = Mathf.Sin(radians); float zVelocity = Mathf.Cos(radians); rb.velocity = new Vector3(xVelocity * forceMultiplier, rb.velocity.y, zVelocity * forceMultiplier);
I not tested this code.