Search Unity

Escalator and FPS controler

Discussion in 'Scripting' started by jo6x, Feb 27, 2017.

  1. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
    Hallo,

    I build an escalator with help of Blender, imported this and works fine.
    But...
    When I step on the escalator with my FPS it won't take me upstairs. It stays on the first step and hangs there while the escalator keeps rolling.
    Is there a way that I can fix this, by using a script?
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,532
    Does the escalator have collision?

    What is your FPS character made up of? A CharacterController?

    CharacterController's aren't pushed around by usual physics, nor they enact force on things with normal physics. You can just change their position with 'Move' and they will move in that direction for that distance unless something gets in the way. You must then do any extra calculations for physics at that point.

    Escalators are like 'moving platforms'. Try googling around for tutorials on 'unity moving platforms with CharacterController', or something like that, you'll get a lot of material on how to accomplish this.
     
  3. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    I could be wrong, but I suspect will be very difficult to use the physics engine to move you up an escalator. Instead but a collider around the bottom of the escalator and the top. You then can use OnTriggerEnter to detect stepping on it, and have some Coroutine move your guy up to the top, until you detect hitting the top collider.
     
  4. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
    mmmmm, that odd.
    When looking at the video on youtube at about 20.38, it seems like it has to work.
     
  5. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    Well then did you follow this video and do exactly what it did?
     
  6. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
    Yes I did, but I made real steps
     

    Attached Files:

  7. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    Maybe post the relevant code that should be moving your guy but isnt.
     
  8. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
    I think that I need to do just that.

    Thanks for helping. :)