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

rigidBody.AddRelativeForce(...) doesn't do antything

Discussion in 'Editor & General Support' started by helgso, May 3, 2015.

  1. helgso

    helgso

    Joined:
    May 3, 2015
    Posts:
    6
    I have a capsule 3D GameObject that has a RigidBody assigned to it. It's Y position is frozen. Adding a script to the capsule with the following code:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerMovementScript : MonoBehaviour {
    5.  
    6.     Rigidbody rigidBody;
    7.     void Start () {
    8.         rigidBody = GetComponent<Rigidbody> ();
    9.     }
    10.    
    11.     void FixedUpdate () {
    12.         rigidBody.AddRelativeForce (Vector3.forward*5f);
    13.     }
    14. }
    should let the capsule move forward with static speed. However, it doesn't move at all. Help?
     
  2. helgso

    helgso

    Joined:
    May 3, 2015
    Posts:
    6
    Turns out it actually worked. It just moved so slow I couldn't see it. Problem solved