Setting node perpendicular to polygon

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Setting node perpendicular to polygon

Post by $L!M »

I need to set my node perpendicular to triangle. I have a triangle, so i can get it normal. But i don't know how I can place my object to be perpendicular to triangle. I hope you understood me.
Sorry for my awfull english.
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Post by $L!M »

Maybe you can't understand my question? I'll make a picture now. %)

Few minutes later ))
Here it is:
Image
Green tube shows general position. And red one shows how i need to place the tube (SceneNode).

I hope you'll help me :roll: .
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

This is similar to methods used for decal nodes -

http://www.gamedev.net/reference/articl ... le1986.asp

You need to get the plane normal of the triangle you are placing the scene node on and use that for rotation. It's really not as simple as you make it out to be, what happens if the object is not setting entirely on a single triangle?

Research that stuff a bit and if you still need help, ask for more information.
Image
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Post by $L!M »

Thnx for answer. I'll read this article.
Spintz wrote:what happens if the object is not setting entirely on a single triangle?
Averaged normal. :idea:
Post Reply