- Home /
Question by
venhip · Jul 13, 2012 at 06:07 PM ·
raycastaddforcerigid body
How do I refer to a different object?
This is a very noobish question on my part, but how do i refer to a different object in script, it isnt a collision but in fact a raycast hit;
function FixedUpdate() {
if (applyForce) {
rigidbody.AddForce(Camera.main.transform.forward * forceStrength);
}
if (reverseForce) {
rigidbody.AddForce(Camera.main.transform.forward * reverseStrength);
}
}
That is the part of my script. I want to add force to the object the ray cast hits (I have it specified elsewhere the detection, ect.) Thanks.
Edit: I forgot to mention this script is attached to the player and detects anything marked with the tag "dynamic".
Comment