[Unity] – I can’t find my ”rigidbody” tab on the right

Updated 6 days ago in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on November 26, 2017

Yo ! I was programming on Unity and I wanted to modify something about the collision detection but when I click on any object but my player 1 on the scene I can’t find that tab. Did I mess up somewhere ?

Video : https://www.youtube.com/watch?v=SnmnpgYWKUA&t=1s

The script that makes the camera follow my player :

< using UnityEngine;

public class FollowPerso1 : MonoBehaviour {

    public Transform perso1;
    public Vector3 offset;

    // Use this for initialization
    // void Start ()

    // Update is called once per frame
    void Update () {

        transform.position = perso1.position +  offset;
    }
} >

The script that makes the collision possibles :

< using UnityEngine;

public class Perso1Collision : MonoBehaviour {

    public Perso1Movement Movement;

    void OnCollisionEnter(Collision collisionInfo)
    {
        if (collisionInfo.collider.tag == “Obstacle”)
        {
            Movement.enabled = false;
        }
    }

} >

The script that makes the movements possible :

< using UnityEngine;

public class Perso1Movement : MonoBehaviour {

    public Rigidbody rb;

    public float forwardForce = 2000f; // <– We declared a variable float to change out forwardForce (REVOIR)… E03
    public float sidewaysForce = 500f; // REVOIR

    // Use this for initialization
    // void Start ()

    // voidUpdate : Update is called once per frame (So the force ”speed” will depend on how many FPS your PC has)
    void FixedUpdate () // FixedUpdate is better to calculate Physics in Unity (”makes stuff looks smoother when you collide with stuff”. Ref. Brackeys EP.2 HTMVGIU)
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime); // <– NOTE : Gotta understand Time.deltaTime better

        if (Input.GetKey(“d”)) // <– QUESTION : Why not ”D” and ”d” instead ? :O
        {
            rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
        }

        if (Input.GetKey(“a”)) // <– QUESTION : Why not ”D” and ”d” instead ? :O
        {
            rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); // Understand ForceMode.VelocityChange better E06
        }
    }
} >

Thanks !

  • Liked by
Reply

Just add the rigidbody component youself using the Add Component button and searching for rigidbody..

 

  • Liked by
Reply
Cancel