Search Unity

Character sit in place

Discussion in 'Scripting' started by cruising, Oct 17, 2017.

  1. cruising

    cruising

    Joined:
    Nov 22, 2013
    Posts:
    329
    Hello!

    I have googled around and did not find any good tut for how to make a character to sit down.

    What i want to do is to have a trigger or just click on the seat and the character move/teleport to the front of the seat and make a animation to start to sit and then loop the sit animation until you press any of WASD and it plays the stop to sit animation.

    Also the character controller needs to be locked so you cant move anything more then the camera.

    If you know any tut or what ever to something similar, please post a link.
     
  2. MP-ul

    MP-ul

    Joined:
    Jan 25, 2014
    Posts:
    230
    Hmm I do not have experience with programing but after all the things I have seen in other games is that you need an object to Correct the position of the character and let the animation be played after moving to that position
     
  3. cruising

    cruising

    Joined:
    Nov 22, 2013
    Posts:
    329
    Yes thats what i want, but i cant find any tutorial for that
     
  4. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Never actually tried sitting, but other than what you have said (which sounds right in my head), I'd say just move the position to the spot, then the rotation, then just let the animation play?

    It's on my "someday to-do" list lol
     
  5. TUGs_The_Unprofessional_Gamer

    TUGs_The_Unprofessional_Gamer

    Joined:
    Dec 21, 2015
    Posts:
    24
    I did this within roughly 10seconds:
    google.com
    "sit unity3d tutorial"
    ->
     
  6. chitogekirisaki0104

    chitogekirisaki0104

    Joined:
    Dec 18, 2022
    Posts:
    2
    Do you figured this one sir? I kindly need a tutorial for this.
    simple tutorial for sitting in unity Like there is a arrow in chair and when you click the arrow you will sit or something similar.
    Thank you and I hope you can reply to my question.
     
  7. Nad_B

    Nad_B

    Joined:
    Aug 1, 2021
    Posts:
    730
    Necroposting is bad. Create your own thread if you have a question.

    What you're asking can be split into several steps:
    1. Detect mouse click on an object
    2. Move the character to that object's position
    2.a Character moves in a straight line? => you'll need "Move game object to x position"
    2.b. Or do you need the character to find its way and avoid obstacles? => you'll need "Pathfinding"
    3. Play "sit" animation when character reaches its destination
    3.a You may need to make the character rotates to match the chair rotation => you'll need "Rotate game object to x rotation"