- Home /
2D Wheel-like ball rolling
Hey there,
My following problem actually sounds simple, but somehow is hard to implement for me though.
I want a 2D ball (or circle) running through a tube to reach higher destinations. In order to get the ball moving I want to roll the ball (through rotation) in the wanted direction by pressing the arrow keys. You press left and the ball increases its left-rotation (for right-key the same). With this concept, I want to get the ball higher and higher in that tube.
THIS is what I want to achieve:
Here comes the problem: I don't actually know how to let the ball ROLL over any surface, like you would roll a ball or a wheel through a tube. When I in-/decrease the balls rotation it only rotates on the ground without moving (like its on ice). But adding only some velocity to the circle results in the following behaviour:
Seems the ball get only thrown away with the velocity property. I guess I need some velocity in relation to the current rotation-speed to get that working for me...
Of course the ball got a RigidBody2D, a 2D-Circle-Collider and is affected by gravity. But as I told you, I don't know very well how to play with all these properties.
Hope you guys can help with an example for that. (Oh and I searched the whole forum for days for such problems... but didn't find anything).
Thanks in advance!! Greetings, ToSh
[EDIT: Sorry for the compact text... The editor didn't let me insert any line-breaks, like shown in the tips. It not even accepted html-tags... weird...]
I think, you create physics$$anonymous$$aterial2d and set this follow. bounciness = 0.0; friction = 1.0;
Thanks for your answer, I'll try that out. Giving feedback when I'm done testing! :)
What do you suggest in addition to the physics$$anonymous$$aterial? Adjusting velocity programatically? Or maybe AdForce??
Sorry, I think you want no bounces and no slip ball. If you want increace speed, you use addforce or addtroque to apply force to rigidbody. this is not test :-) ----(add force Code)--- void FixedUpdate() { var body = GetComponent(); float addGravityLikeForce = 0.1f; if (body.velocity.y < 0.0f) { body.AddForce(Vector2.down * addGravityLikeForce); } } ----(add force Code end)---
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Character keeps jumping up walls 2 Answers
Unity 2D - Rigidbody2D Velocity sudden freeze 0 Answers
While Moving Left or Right my character falls more slowly. 2 Answers