Search Unity

Trouble with picking up objects

Discussion in 'Getting Started' started by joshji, Mar 19, 2017.

  1. joshji

    joshji

    Joined:
    Mar 19, 2017
    Posts:
    1
    Help me with the scripting for picking up objects
     
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Well come @joshji to the Unity community!! I'm new making same questions. Wile I'm waiting, I will try to answer your request.

    In the tutorial learning section, you find physic component. When a collision is detected now you are close to an object (objects are call GameObjects) that you can pick up. So in your code, first you look if the player is close to the object using an if statement. If it is then you run the function to pick up. probably what you are looking for is on collision enter. So look the physic tutorial [link]

    You need to make a special collider that detects if the player is near. Look also the game tutorials. In the live section there are a lot of example. If you look to them carefully there is what you are looking for.

    In alternative a way to find a solution is to use youtube videos:

    Good luck!!
     
    Last edited: Mar 21, 2017