Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

About Gravity RigidBody2d in unity

Discussion in 'Getting Started' started by Manu1045, May 29, 2023.

  1. Manu1045

    Manu1045

    Joined:
    May 29, 2023
    Posts:
    2
    I'm making a small 2d game on unity. I have a character that cast a bright spell prefab when I press enter and I have dozens of others enemies I wish that when the magicprefab hit some enemy his Gravity Scale suddenly diminish so that he begin to levitate I don't know how to write this script

    Could you help me ??
     

    Attached Files:

  2. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    Gravity is a constant value (-9.81) for all Rigidbodies on the Scene. So to go up, you need to have a negative Gravity Scale.