I keep getting an error with my code:
error CS1501: No overload for method Attract' takes
0’ arguments
Here is my code:
using UnityEngine;
using System.Collections;
public class PlanetGravityEnter : MonoBehaviour {
public float gravity = -10f;
public void OnTriggerStay (Collider player)
{
Attract ();
}
public void Attract(Transform body)
{
Vector3 targetDir = (body.position - transform.position).normalized;
Vector3 bodyUp = body.up;
body.rotation = Quaternion.FromToRotation (bodyUp, targetDir) * body.rotation;
body.rigidbody.AddForce (targetDir * gravity);
}
}
Thank you