- Home /
 
adding force
how can i make this script move objects by force, rather than by changing there position?
 private GameObject PullOBJ;
 public float PullSpeed;
 public float objRotationSpeed;
 public float rotation;
 public float PullStrength;
 public void OnTriggerStay (Collider coll)
 {
     if (coll.gameObject.tag == "Untagged") {
         PullOBJ = coll.gameObject;
      PullOBJ.transform.position = Vector3.MoveTowards (PullOBJ.transform.position, this.transform.position, PullSpeed * Time.deltaTime);
      PullOBJ.transform.RotateAround (transform.position, Vector3.up, Time.deltaTime * rotation);
      PullOBJ.transform.Rotate (Vector3.left, 45 * Time.deltaTime * objRotationSpeed);
  }
 
               }
               Comment
              
 
               
              Answer by raybarrera · May 20, 2018 at 07:47 PM
Sounds like you want to look at the AddForce method of Rigidbody. You can read all about it in the docs.
Your answer
 
             Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
add force to object that has 2 different rigid bodies 0 Answers
pulling in objects one end, and releasing out the other 0 Answers
add force at position with respect to rotation 1 Answer
Top-down space flight physics - AddForce - Object moves off center the faster it goes 0 Answers