- Home /
How to make a sticky ball?
Hello. I working on my super project Click to watch
Use left mouse button for road painting. I want make my ball sticked to the road, it means that ball still can moving on the road, but if ball gets on the hump = he don't jumping in the air. But if road is ending - ball jumping forward free. What tips can you give me? Thanks
I read your question when you first posted it, and did not understand it well enough to answer. I could not get the road painting to work. $$anonymous$$aybe you just need to calculate the distance to the road and use Rigidbody2D.$$anonymous$$ovePosition() to keep it on the road, allowing it to go free if the road has ended, or maybe you need to add some downward force to the rigidbody to counteract jumping.
Answer by Pecek · Jul 20, 2014 at 09:25 PM
Don't use rigidbody if you don't want physically correct movement, make a basic controller for that, or cast a ray from the ball towards the ground, if it hit, then set the vertical position to the ray's hit point's vertical position.
If you are not familiar with raycasting: http://docs.unity3d.com/ScriptReference/Physics2D.Raycast.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613154457im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I make my player 'stick' to a fixed object 1 Answer
If A collide with B A will become Child of B - C# 3 Answers
Make Animal sticky to bricks 0 Answers
Connect 2 rigidbodies 0 Answers