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

Freeze object x y z position

Discussion in 'Scripting' started by GamerBurakYoutuber, Feb 21, 2021.

  1. GamerBurakYoutuber

    GamerBurakYoutuber

    Joined:
    Jun 10, 2020
    Posts:
    7
    The rigidbody is 3d. and i want if i enter a collision, the xyz positions are freezed.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    You can either destroy the Rigidbody so the object stops moving, or else set all the constraints to prohibit moving and rotation. It depends if you want that exact object to keep going again later.
     
  3. GamerBurakYoutuber

    GamerBurakYoutuber

    Joined:
    Jun 10, 2020
    Posts:
    7
    Huh? i need the freeze xyz throught the script.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    That's what my answer is for.

    Look for Destroy() documentation.

    Look for Rigidbody constraints documentation.
     
  5. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042