This content has been marked as final. Show 3 replies
I think you could place the cylinder at the point of intersection on the
face, then use the pointAt() command to point the cylinder at a vector set
to the world position of the cylinder + the isectNormal vector.
Although I'm sure someone will suggest a more mathtastic way to do it :)
After placing the cylinder at the intersect position, do this to adjust the rotation:
tiltAngle = vector(0,0,1).anglebetween(surfaceNormal)
tiltVector = surfaceNormal.perpendicularto(vector(0,0,1))
myModel.transform.rotation = vector(0,0,0)
If the cylinder's origin is at its centre, you'll then need to do a 'translate' command, to move it along its own z axis by half its length, so that it sits on the surface of the mesh instead of halfway embedded into it.
hope this helps!