- Home /
Raycasthit and normal orientation
Hi everyone !
Please scuse my poor english, that's not my natural born language
I managed to instantiate an object from a raycasthit position but now, I'm having trouble on instantiate it at a certain distance "away" from the hit position. To be a little bit more precise, I want to instantiate the object away from the hit point BUT along the normal face orientation. I tried to work with the hit.normal but I probably did it the wrong because it didn't work at all !
My explanation is probably a bit confusing so here's a quick sketch that I hope will help you understand what I'm trying to do :
Any help will be really apreciated, thanks in advance !
Answer by dudester · Jan 23, 2015 at 12:26 PM
Well code would really help but I'll try and understand what you want. So basically the problem is as far as I've tried is that normals position is incorrect in terms of the position on a mesh,its to far away from the mesh to really matter,so what I did is use the meshes vertices,so if you dont mind where exactly its postion above the hit.point just use the hit.point+ vector3.up*(//however far you want it to be)take not that vector3.up moves the object up 1 unity unit so if its not high enough just times by how high you want it or if you want it to the left use vector.left and so on.hope ive helped a bit.if you need any other help I can post it but for now without code to see what you trying to do I cant help much.