- Home /
Adding rotation to Physics.AddForce(); ... Getting weird error?
Ok I'm getting a really weird error. I have 2 codes, 1 is a gun script to shoot and another is a ragdoll script for my zombie that I'm shooting. When I raycast and hit a zombie, I use
if (hit.transform.GetComponent<KillZombie>()) {
hit.transform.GetComponent<KillZombie>().raycastDirection = transform.position;
}
For some reaon, it keeps saying it can't convert Vector3 to Trasform. Obviously it says transform.position above. So why isn't this working?
Thanks for anyone who can figure out the problem. All of these variables are transforms, not vector3's.
$$anonymous$$y guess would be that ".raycastDirection" is a transform so basically you're trying to assign a Vector3 variable (transform.position) to a transform...
There's a difference between http://docs.unity3d.com/Documentation/ScriptReference/Transform.html and https://docs.unity3d.com/Documentation/ScriptReference/Vector3.html