Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Dragging doors, opening and closing.

Discussion in 'Scripting' started by GladGoblinGames, Aug 27, 2015.

  1. GladGoblinGames

    GladGoblinGames

    Joined:
    Dec 14, 2011
    Posts:
    118
    Hi all,

    Been stuck on this for a while now. Its semi - working but I can't get the door to open all the way. Not only that, once drag has ended, the door closes itself. Not sure why. I've posted an image below with the settings I'm using.



    The player controller I'm using is the FPSController provided by Unity, with the DragRigidbody script attached to it. The 'Door Script' does nothing for opening and closing the door. It only handles if the door is locked or not.
     
  2. Code to Reality Studios

    Code to Reality Studios

    Joined:
    Aug 25, 2015
    Posts:
    64
    Would you mind posting the script so I can see what might be the issue?
     
  3. rafaelbarretobra

    rafaelbarretobra

    Joined:
    Aug 5, 2015
    Posts:
    11
    You need to change the Input.mousePosition inside DragRigidbody to a point in front of the camera (the distance between your camera and the door handle, you need to figure out how much with debugging).
    I just finished working on this solution. I'll present it on a workshop next week for free, feel free to join us at https://discord.gg/w7J4YAM3fq