How to use Vector3.project?

I’m having trouble understanding how this works… Basically, I want to fire a ray, hit a wall, get the normal, project a distance off of that hit point based on the normal, then store the result vec3.

Can someone provide a basic example of how that might work? My application is done through Playmaker but I’m having a hard time understanding why it isn’t working like I’ve laid it out so I must be missing something. I assumed vector3.project would be the way to go but is there another way to get a point based on vector 3 position, a vector 3 offset and a normal?

1417445--74411--$normal.jpg

Thanks

If you’re using Raycast/Linecast, have you checked out RaycastHit.normal?

Something like this should work:

RaycastHit hit;
float distanceFromHit = 3f;
Vector3 destinationPosition = hit.point + (hit.normal * distanceFromHit);

Note - example code, not intended for copy/paste.

Ahh I see, all I need to do is multiply the normal * the distance I want and add it to the vector? I was worried this was going to give me weird coordinate results, but i guess i was confused about the normal being a direction and didn’t realize I could multiply from it.

Indeed, the hit normal basically gives you a normalized direction pointing directly away from the hit collider face.