I have the following script attached the the "projectile" I thought that the "direction" variable take the vector3 of the owner of the script but it did not. I am a novice and I appreciate any help.`using UnityEngine;
using System.Collections;
public class Projectile : MonoBehaviour
{
public float power;
private Vector3 direction;
void OnTriggerEnter(Collider other)
{
direction = Vector3.forward;
other.rigidbody.AddRelativeForce(direction * power);
}
}`
Thanks!
↧