Hi There,
I’m tired so for some reason trying to convert Vector3 to float etc- so can somebody tell me how I should amend this code. Bascially I want to send an object a message with the hit.point and hit.normal so that a function at the other end can do some cool stuff with it. I see that SendMessage can only send one thing at a time, I tried the code below to split it into two parts, but obviously the x and y of the Vector2 can only be floats…
-
Should / Can I send an array with the two details ?
-
Is there a better way?
Thanks!!!
//Check for mirrors and reflect off them if you hit one.
var HitObject = hit.transform.gameObject;
if (HitObject.tag == "mirror"){
var ReflectDetails : Vector2;
ReflectDetails.x = hit.point;
ReflectDetails.y = hit.normal;
HitObject.SendMessage ("DoReflectLaser", ReflectDetails);
}
This worked out great, don't know what I was thinking lol. And sorry about the super late response. Thanks for advice.
– anon16752599