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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

EASILY pick up and throw objects! 2018

Discussion in 'Community Learning & Teaching' started by Mwester, Apr 26, 2018.

  1. Mwester

    Mwester

    Joined:
    Mar 13, 2017
    Posts:
    72
    In this updated tutorial, I go over the issues that the last video on this subject had, and we create a brand new system perfect for any game that involves picking up game objects! I also teach how to create a throw system that is easily modified, as well as implementing collisions and distance vectors.

     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,384
    When making public tutorials it's a really good idea to avoid doing silly things like putting
    GetComponent
    in the Update method, especially when you already have a member reference to the object. Beginners see this type of thing and assume it's good/correct and develop really bad habits.
     
  3. Mwester

    Mwester

    Joined:
    Mar 13, 2017
    Posts:
    72
    I honestly didn't even know this was a bad practice=P Thanks for the tip!
     
  4. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    It's bad practice because you're literally getting something every frame and that is terrible, just cache it once at the start, and there you go.
     
  5. CelticKnight

    CelticKnight

    Joined:
    Jan 12, 2015
    Posts:
    378
    I tried modifying this script to work in 2d - no luck. I was really hoping it would work because it had some concepts that I really liked and because I have a object I need to pick up and throw in my current project.
     
  6. Eliasyass

    Eliasyass

    Joined:
    Nov 23, 2018
    Posts:
    3
    What is the code for moving your charachter?
     
  7. Eliasyass

    Eliasyass

    Joined:
    Nov 23, 2018
    Posts:
    3
    When the cube move to his place he is getting tranformed(distortion)