My complete script dont work (if a collision appear, push)
So im learning c# by myself, and obviously i need help. I want an object "magnet" to push another one "capsule" when it collide with, like a magnet on push polarity. i set a wider colider box for the magnet to make like a field of effect and set it to kinetic, to be sure he doesnt get pushed back. So, i got a lot of error (duh) and would like to ask your help to tell me and show me what doesnt work in my code. so there it is. thanks for all the help (note my magnet object is in angle and rectangular, i need it to make the magnet push the capsule in the direction the magnet is oriented)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PushEffect : MonoBehaviour
{
public float thrust;
void Start()
{
void OnColisionEnter(collision);
gameObject.Find(capsule);
}
void Update()
{
{
if OnCollisionEnter(capsule);
this.AddForce(transform.forward * thrust);
}
}}
Your answer

Follow this Question
Related Questions
Count objects inside a dynamic area? 0 Answers
Soccer game, more realistic net 1 Answer
How To Make A Character Stop At A Block? 0 Answers
Scripting trouble, Float on Collision/collision open gate 2 Answers