Search Unity

Plane to Plane Transition.

Discussion in 'General Discussion' started by zXSmashXz, Nov 2, 2014.

  1. zXSmashXz

    zXSmashXz

    Joined:
    Nov 2, 2014
    Posts:
    15
    Hello Unity Community,

    I am a newcomer to Unity. I have completed the Roll-a-Ball tutorial and am expanding on this for practice. However I have encountered a problem when the player transitions from plane to plane.
    For some reason with my 2 planes scaled and positioned exactly the same on the Y axis there is a "bump"
    in the transition area when the ball rolls over the joining section. Can anybody give me some pointers here or explain to me why this happens. I can present the file for inspection if needed.

    This is also my first post on the forum so if it is in the wrong location I apologize in advance.
     
  2. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Hi,

    I've never did a Roll-a-Ball tutorial. Can you post a script using valid tags?
    BTW Next time if you have any issues create a thread on a "Scripting" section.
     
  3. zXSmashXz

    zXSmashXz

    Joined:
    Nov 2, 2014
    Posts:
    15
    I dont think my problem is the scripting, simply the in game "Plane to Plane" transition is not smooth as I thought it should be. Just in case here is the script that controlls the player (Sphere)

    using UnityEngine;
    using System.Collections;

    public class PlayerController : MonoBehaviour {

    public float speed;

    void Update() {
    float moveHorizontal = Input.GetAxis ("Horizontal");
    float moveVertical = Input.GetAxis ("Vertical");

    Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

    rigidbody.AddForce (movement * speed * Time.deltaTime);
    }
    }
     
  4. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Don't forget using code tags
    Code (csharp):
    1.  example code
    As code becomes more and more complex it's almost impossible to read it on forums.

    You were talking about "Plane to Plane" transition. What does that mean? I thought it was about switching levels.
     
    Last edited: Nov 2, 2014
  5. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    He has two planes with the edges (at least theoretically) lined up perfectly, and is wondering why his ball when crossing that boundary "bumps" a bit instead of being a perfectly smooth transition.

    My guess, without seeing the project is to check the actual colliders. It is possible that even though the meshes are perfectly lined up that the colliders are not, either vertically(one slightly higher than the other) or horizontally, where they may be a slight gap in the colliders.

    I don't see anything specifically wrong in the script, though I'm not very practiced yet.
     
    elmar1028 likes this.
  6. zXSmashXz

    zXSmashXz

    Joined:
    Nov 2, 2014
    Posts:
    15
    here is a link to a video description of the problem
     
  7. zXSmashXz

    zXSmashXz

    Joined:
    Nov 2, 2014
    Posts:
    15
    it may be a mesh problem
     
  8. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Try to make second plane lower (the small plane) than the first one (the large plane) by at least 0.5 or 0.1. It won't be perfect, but it should do the trick.
     
  9. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    I see you increased the size of your suggestion distance. Maybe I'm wrong, but wouldn't that create a bump directly that is worse than what he has? I'm not testing it, so maybe I'm wrong.

    Another thing I can suggest, after testing elmar's thing(since it is quicker than what i suggest) is to go from using mesh colliders to using actual plane colliders. They are simpler, faster, and it may or may not fix the problem too.
     
  10. zXSmashXz

    zXSmashXz

    Joined:
    Nov 2, 2014
    Posts:
    15
    I will give it a go thnx for the input guys,
    will let you know how it works out for me
     
  11. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Or maybe use cubes. That might work too.
     
    kburkhart84 likes this.
  12. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    Something occurred to me. You could use one big plane/cube for the whole floor, since it is all flat, at least it looks flat in the video. It doesn't matter if some of the floor collider is outside of the area because you have the walls that won't let it get outside anyway.
     
    elmar1028 likes this.