Search Unity

Mount/Dismount a horse

Discussion in 'Scripting' started by sgemmen9, Feb 7, 2016.

  1. sgemmen9

    sgemmen9

    Joined:
    Jul 24, 2015
    Posts:
    17
    Hi,

    I'm basically trying to click a key on the keyboard, have my character use my mount animation, and while in motion a horse appear underneath of me. (Kind of like Elder scrolls online if you've ever played that.) Then be able to control the mount since I am now mounted. If possible, I'm looking for replies to be specific with code since I'm kind of a beginner. Any help would be great.
     
  2. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Wouldn't it be far better to start out with something easier and more basic things?
    Depending on many factors, this can be more or less complex, so unfortunately I won't just throw scripts in here as i had to write them from scratch anyways. Maybe someone has already made tutorials or assets, but basically:

    - Check for key input
    - Calculate the position that the mount has to appear at (if no animation prior to mounting up)
    - spawn/activate the mount's gameobject
    - deactivate the player controller script, enable the mount controller script

    That's probably the most trvial solution (besides just replacing the players with an already mounted player) which breaks down into these 4 parts and it can be achieved with the basics of coding and a little sense for math already.
     
  3. sgemmen9

    sgemmen9

    Joined:
    Jul 24, 2015
    Posts:
    17
    @Suddoha, thanks! You're tips led me on a direction that resolved my problem. Granted it took a few hours, and I now have other problems... but it's functional. Thank you!
     
  4. frekiidoochmanz

    frekiidoochmanz

    Joined:
    Feb 7, 2016
    Posts:
    158
    im no programmer but You can also get information from the mount by storing some kind of sphere or area of influence and allow actors or the mount to retrieve data from the location of objects within or being detected as being inside of this and if it is true do the rest of the mounting logic. (to even allow multiple actors to mount 1 horse, and the seats int he horse can be a list of currently using actors, and then each actor in list can be tracked as being in a certain seat depending on their priority in the list or a tag appended to their spot in the list... )

    again im not a coder sorry