# Rendering a quad, facing a normal

This topic is 5063 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 :)

1. 1
2. 2
JoeJ
20
3. 3
frob
19
4. 4
5. 5

• 10
• 10
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632200
• Total Posts
3004739

×