Hi - Just starting with Unity
Can someone tell me why my rigid body object is going through another rigid object?
When I turn on Collision Trigger it does turn around, but with it off it goes right through the wall
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour {
public Rigidbody rbody;
private float speed = 3;
void Start () {
rbody = GetComponent<Rigidbody> ();
}
void FixedUpdate () {
Vector3 movement = transform.forward;
Vector3 direction = movement.normalized;
Vector3 velocity = direction * speed;
rbody.position += velocity * Time.deltaTime;
}
void OnTriggerEnter(Collider triggerCollider)
{
/*
if (triggerCollider.tag == "Cube2" || triggerCollider.tag == "Cube1") {
if (rbody.position.z >=10) {
rbody.rotation = Quaternion.Euler (0, 180, 0);
} else if (rbody.position.z <=10 ) {
rbody.rotation = Quaternion.Euler (0,0, 0);
}
}
*/
}