AddRelativeForce being applied to the player?

So I made a script that is supposed to push a box forward by applying force, but when I move the player around it goes flying. I believe that it is due to the application of force thing but I’m not sure how to fix it. Here is the script “in” the box (using C#).

using UnityEngine;
using System.Collections;

public class Onclick : MonoBehaviour {
	private int force = 1000;
	public static Vector3 Boxpos;
	private int distance = 10;

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
		Vector3 Boxpos = transform.position;
		if (Vector3.Distance (Playerpos.PlayerPosition, Boxpos) < distance)
			if (Wandtype.wandtype == "push")
				if (Input.GetMouseButtonDown(0))
					rigidbody.AddRelativeForce (Vector3.forward * force);

using UnityEngine;
using System.Collections;

public class PushBox : MonoBehaviour 

    public Vector3 forceDirection;
    public int distance;
    public float forceApplied;
	void Update () 
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray,out hit,distance))
        if(hit.transform.tag == "box")
            //if you want to dynamic change in position

            //if you want the box to move forward with a force of force applied
            hit.rigidbody.AddForce(Vector3.forward * forceApplied);

            //if you want to add a relative force 
            hit.rigidbody.AddRelativeForce(Vector3.forward * forceApplied);


  • Add a rigidbody to your box. AddComponent->Physics->Rigidbody.
  • Add a realistic weight to the box and apply a realistic force.
  • Do not check distance between all the boxes in the scene. It will lag the game.
  • activate the script when “Wand” is active.