- Home /
I am trying to have a ball roll on a line that was drawn from a Line Renderer
I am trying to have a ball roll on a line that was drawn from a Line Renderer.
Is there a way I can have a box collider that follows the line, because I have 2 points with the line and the line moves when the points move. Is there a way to have a box collider follow the line, and so that a ball can roll on it?
Answer by robertbu · Oct 06, 2014 at 12:21 AM
Whether a ball will roll, slide, or bounce down an inclined collider will depend on Unity's Physics2D implementation, the physic material you give bot colliders (ball and incline), and any other forces you might apply (like torque). This should be quick and easy for you to test and develop. The code at the following link resizes a game object between two other Transforms and can easily be rewritten to use two Vector3s instead. Apply it to an empty game object with a box collider and a localScale of (0.01, 1, 1).
http://answers.unity3d.com/questions/613373/rotating-an-object-between-2-points.html
Your answer
Follow this Question
Related Questions
'center' is not a member of 'UnityEngine.Collider'. 2 Answers
How can I make diagonal collisions work with raycasts from a boxcollider? (3D, C#) 0 Answers
What is the advantage of using Box Collider with a center of (0.5, 0.5, 0.5) 1 Answer
Help with collision mechanics 0 Answers
Collider Displacement Issue 0 Answers