Ok so I have painter brush that raycasts to the ground so i have this:
I have the hit but how would I get the right and forward of that hit?
I Tried using the Vector3.Cross like this:
Vector3 right = Vector3.Cross(hit.normal, Vector3.left).normalized;
Vector3 forward = Vector3.Cross(hit.normal, Vector3.forward).normalized;
It works fine when the recast hits a ground like structure:
But when I try painting on wall it only works left and right:
Hi @Reid_Taylor, I have some problems with your description, and perhaps as a result I don’t understand your overall problem
normal right and left are simply the negative of each other, as they are with forward and backward, and up and down.
The cross product yields a vector that is orthogonal to the plane formed by two vectors (i.e. at a right angle to both input vectors). So your the language of your code:
Vector3 right = Vector3.Cross(hit.normal, Vector3.left).normalized;
Vector3 forward = Vector3.Cross(hit.normal, Vector3.forward).normalized;
doesn’t make sense to me. right is not the result of the cross product of those two parameters in the first line - forward or up would be. Likewise, neither would forward be in the second line.
So, it is hard to understand your problem. For me, I don’t see enough to understand the wall issue
Can you clarify further?