# Rendering a quad, facing a normal

This topic is 5400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, This is to be used in bullet decals. So, lets imagine i have the point of impact, and the normal of the face at where the impact was made. With this two values, is there a way to render a quad that faces that normal ? thanks

##### Share on other sites
Yes. You need two vectors perpendicular to the normal, let's call them Up and Right. These can be obtained for example using cross product. Given a unit-length normal vector N:
// epsilon is something like 1e-3// we do this to prevent floating-point inaccuracies// also, cross(v,v) is a null vector which we don't wantif(N.y < 1-epsilon)  Right = cross(N, (0,1,0))else  Right = cross(N, (1,0,0))Up = cross(Right, N)

Now, the vertices for the quad are (if you want the quad centered around the point of impact):
V1 = Point - Up/2 - Right/2V2 = Point - Up/2 + Right/2V3 = Point + Up/2 + Right/2V4 = Point + Up/2 - Right/2

Thanks :)

• 13
• 18
• 29
• 11