Page 1 of 1

2 sides of a card

Posted: Tue Jun 07, 2011 12:29 pm
by Varn1807
Hello i'm new to irrlicht so please don't jump on me if I say something wrong :P.
Using tutorial 3 i created the 2 nodes representing the 2 sides sides of a game card. On one I put a texture(the front of the card) and on the other the back of the card.

Now i need to create a node in which to add the other 2 nodes as child, and of course the distance between the 2 to be minimum so I can see them.
I have no ideea how to add child ( besides the simple function parent->addChild(child)).

Thanks in advance

Posted: Tue Jun 07, 2011 12:40 pm
by Radikalizm
It's not a good idea to create 2 different nodes to represent 1 card, it gets harder to manage and causes overhead since you need to do 2 draw calls for each card

Why not create a rather flat 2-sided card mesh which you can texture accordingly? You can then just manage this mesh with 1 scene node

Posted: Tue Jun 07, 2011 12:46 pm
by Varn1807
the bad part is that i have to do it like this... don't get me wrong i'm not trying to make my homework or something like this. :))
Unfortunetly this is how i have to do it, i made the 2 nodes now i have to make a third node in witch to put the other 2 as children and i have no ideea how to do that

Posted: Tue Jun 07, 2011 12:54 pm
by Radikalizm
Varn1807 wrote:the bad part is that i have to do it like this... don't get me wrong i'm not trying to make my homework or something like this. :))
Unfortunetly this is how i have to do it, i made the 2 nodes now i have to make a third node in witch to put the other 2 as children and i have no ideea how to do that
And why exactly do you have to do it this way?

If you really have to, you could create an empty scene node and add both sides as children with the addChild() method, be sure to align their positions and rotations correctly
If you are using planes to represent the sides of the card you'll probably get z-fighting issues when you put them back to back though, so that's another reason for not using this approach

Posted: Tue Jun 07, 2011 1:25 pm
by Varn1807
thanks for the answer, it's going to be hard/weird but thanks :D

Posted: Tue Jun 07, 2011 2:50 pm
by ChaiRuiPeng
Radikalizm wrote:
Varn1807 wrote:the bad part is that i have to do it like this... don't get me wrong i'm not trying to make my homework or something like this. :))
Unfortunetly this is how i have to do it, i made the 2 nodes now i have to make a third node in witch to put the other 2 as children and i have no ideea how to do that
And why exactly do you have to do it this way?

If you really have to, you could create an empty scene node and add both sides as children with the addChild() method, be sure to align their positions and rotations correctly
If you are using planes to represent the sides of the card you'll probably get z-fighting issues when you put them back to back though, so that's another reason for not using this approach

wouldn't z fighting only happen if their vertex normals arefacing the same direction? if from my understanding of authors post, those two planes would be invisible (their normals are opposite directions)

Posted: Tue Jun 07, 2011 3:00 pm
by Radikalizm
Yes you are right, I wasn't thinking about the possibility of backface culling

Still, the one node per side approach really isn't ideal, and I'd be very interested to know why it has to be done like this exactly

Posted: Sat Jun 11, 2011 2:50 pm
by grumpymonkey
don't be so judgemental he's a beginner :lol: