Hi,i want this raycast script detects only player,NOT ALL WORLD OBJECTS,but only player…i realy like this script how it looks and works,so here needs to just change just some lines.
Here is the script:
function Update () {
var fwd = transform.TransformDirection (Vector3.forward);
if (Physics.Raycast (transform.position, fwd, 10)) {
print (“There is something in front of the object!”);
}
}
I guess here needs to change these lines(to detect player only):
var fwd = transform.TransformDirection (Vector3.forward);
if (Physics.Raycast (transform.position, fwd, 10)) {
Okey works pretty good,but can you please help me to make raycast like:when object touches player (not player,but object) and then print (“Player is touched the object”).Can you please help me to make that?