Hi Guys,
This might be really simple but it's had me stumped for about an hour now. I am trying to create a fan, which blows other games objects in which ever direction it is facing. Simple enough but I can't work out what I m doing wrong. This script;
var force : float;
var contact : GameObject;
var myPos : Vector3;
function FixedUpdate()
{
myPos = gameObject.transform.position;
}
function OnTriggerStay(other:Collider)
{
if(other.gameObject.tag == "Player")
{
contact = other.gameObject;
contact.rigidbody.AddRelativeForce(Vector3.up * force * Time.deltaTime);
}
}
Adds relative force based on the orientation of the object itself, not the direction of the fan. Can some clever folk please advise, many thanks in advance!
↧