So basically, this is my code, i´m beginner so i´m doing it the stupidest way, i know. I got error "CS0501" and it targets the fifth line (the one with void OnCollisionEnter(Collision touchInfo); ). Please, i need some help
using UnityEngine;
public class movingPlatform : MonoBehaviour
{
void OnCollisionEnter(Collision touchInfo);
public Rigidbody rb;
public float speed = 300f;
// Update is called once per frame
void Update()
{
rb.AddForce(speed, 0, 0);
if (touchInfo.collider.tag == "odrazeni1") // detekuje kdyz se kostka dotkne prekazky
{
rb.AddForce(-speed, 0, 0);
}
if (touchInfo.collider.tag == "odrazeni2") // detekuje kdyz se kostka dotkne prekazky
{
rb.AddForce(speed, 0, 0);
}
}
}