Hello, I'm trying to make a wall that push an object when it hits the wall and when the wall its yellow painted.
I already made a wall that when I paint the wall with the blue color, it pull an object, but I don't know how to make pushing it when its touching.
Here's the Yellow Wall Script (it works):
using UnityEngine; using System.Collections; public class NewBehaviourScript : MonoBehaviour { public Rigidbody bola; public float speed = 2; public void Update(){ } public void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == ("bola")){ if (renderer.material.color==Color.yellow){ Debug.Log("tocou"); bola.transform.Translate(Vector3.forward* speed * Time.deltaTime); } } } }