Began the pillow swinging action

Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
RosimInc 2015-08-23 13:53:36 -04:00
parent eff22d0d6b
commit 2ee831b878

View File

@ -223,7 +223,23 @@ public class Child : MonoBehaviour
pillow = null;
}
}
}
public void Swing()
{
//1. Determine if there is someone in front
Transform t = null; //GetTarget
if(t == null)
return;
//2. Apply force to the person
Vector3 direction = target.transform.position - transform.position;
direction = direction.normalized;
t.gameObject.GetComponent<Child>().Push(direction * ThrowForce);
}
void OnCollisionEnter(Collision collision)