Question by
Jdogmaster · Oct 03, 2018 at 12:57 AM ·
transformaddforcetransform.positionforceaddexplosionforce
Convert transform.position to Force
Hey so I am making a tornado that picks up objects and rotates them around. It works nicely but i would like to use Forces, rather than transform.position. So i was wondering how i could convert this script to do the same thing accept use addforce, or addexplosionforce, to create the effect.also i would like it if the closer it an object gets to the tornado the more force is applied.
private GameObject PullOBJ;
public float PullSpeed;
public float objRotationSpeed;
public float rotation;
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
Your answer
Follow this Question
Related Questions
Rotating a cube in 3D ,Rotating a cube into specific coordinates with given input 0 Answers
How to AddForce up to a certain height and then stop? 0 Answers
How do I get objects in front of the player to be blasted away? 1 Answer
Why isn't AddExplosionForce working? 1 Answer
Moving an object to a random position between two objects 1 Answer