Public Group

# Calculating right vector for decals

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

## Recommended Posts

Hi! I'm following this tutorial: http://www.flipcode.com/articles/article_decals.shtml to add decals to my game. I've got to the point where it says "When the face normal is equal to the major axis, the Right vector needs to be built by hand. Building the Right vector by hand is very simple, see the demo source code if you are unsure about how to build it." But the link to the demo no longer works :-( So could someone tell me how to do build the right vector? (I've got all the code implemented but the cross product IS equallying zero so of course I have a problem. and I can't figure it out myself!) Thankyou, Dan

##### Share on other sites
For this sort of decal I would just make the right vector parallel to any edge from the target face; then you don't have to worry about any special cases.

##### Share on other sites
I don't have a face or edge, just the normal and point of intersection (given from ODE).

If the special case is simple as suggested... then tell me it :)

Or any other suggestions of course.

##### Share on other sites
Quote:
 Original post by xDanI don't have a face or edge, just the normal and point of intersection (given from ODE).
Oh, I see. In that case, I think the tutorial you linked to has it backwards. You want to cross the face normal with the cardinal axis with which it is least aligned, not most aligned. This will be the axis that corresponds to the component of the normal with the smallest magnitude. With this method there are (again) no special cases, and the resulting basis will always be valid.

Thanks :D

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5

• 9
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009389
• ### Who's Online (See full list)

There are no registered users currently online

×