So i’m adding script to my projectile so it will look at the mouse cursor position, turn to face it then apply an initial burst of force set by the player in the inspector, after which gravity will take hold. I get error CS0103: The name ‘AddForceAtPosition’ does not exist in the current context, I can’t seem to see a way around without sacrificing the ability to set the speed in the inspector (which is important)
void Start()
{
theRB = GetComponent<Rigidbody2D>();
gameObject.layer = myLayer;
Physics2D.IgnoreLayerCollision(myLayer, myLayer, true);
// GETS WHERE THE CURSOR IS ON THE SCREEN
Vector3 worldMousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
// LOOK TOWARDS THE CURSOR
transform.LookAt(Vector3.zero);
// THEN ADD INITIAL VELOCITY
theRB = AddForceAtPosition(nutSpeed);