Search Unity

Spheres, Addforce, and Collider Seams

Discussion in 'Physics' started by L_Vi, May 1, 2017.

  1. L_Vi

    L_Vi

    Joined:
    Mar 5, 2015
    Posts:
    9
    Hi Everyone,

    How to solve this problem has been driving me crazy for weeks now. Try this:
    • Create a new scene
    • Add 8 x planes (or cubes) and align them perfectly in a line
    • Add a sphere, and place it at the far end plane
    • Add the trail renderer component to the sphere, a rigidbody (add some drag), and a very quick script to addforce along the 'floor' (enough force that it should at the very least reach the end)
    • The sphere will catch on the seams between the planes causing it to bounce, instead of rolling perfectly along the 'floor'
    How to people work around this?

    Things I've experimented with no success:

    Physics:
    • Sleep Threshold
    • Default Contact Offset
    • Solver Iterations
    • Gravity
    • All matter of physics materials
    Rigidbody:
    • Everything in the panel
    • Max Angular Velocity
    Colliders:
    • Various types of colliders
    • Overlapping colliders
    Things I'm considering but not sure how:
    • Runtime merge of mesh? (as 'real' use scenario would not just be a simple row of planes)
    • Raycast in front of the sphere and make some sort of adjustment?
    • OnCollisionEnter to detect the seam, and some sort of adjustment that way?
    Obvious Answers:
    • Create one single mesh and import it into Unity. Yes that is do-able, however, in the long term it would be preferable to be able to use modular parts

    • Constraining the sphere on the Z axis is also possible. However, if you then tackle the same problem with the planes at an angle, we're back to square one,
    Any help would be appreciated.
     
    Last edited: May 1, 2017
  2. rbOthree

    rbOthree

    Joined:
    Oct 16, 2010
    Posts:
    67
    Sorry for digging up this thread but I'm having a similar problem, did you ever solve it?
     
  3. Plystire

    Plystire

    Joined:
    Oct 30, 2016
    Posts:
    142
    Store your ground as a heightmap instead of meshes, and then use vertex manipulation to generate the ground geometry at runtime into a single object. You're probably right on track in thinking that the seams are causing issues, so top priority should be to remove them.