Irrlicht basics tutorial [Note: HUGE POST]

A forum to store posts deemed exceptionally wise and useful

How would you rate this tutorial?

Great
57
42%
Good
51
38%
Fine
21
15%
Bad
7
5%
 
Total votes: 136

shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

This is a really nice tutorial. Still can be improved though. Adding fixed and working versions of the codes will be really nice. I don`t think that there are much guys so fallen in love with the old versions to use it. :lol:
or, another more "accurate" collision function:
Code:

bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getBoundingBox().intersectsWithBox(two->getBoundingBox())) {
return true;
return false;
}

havent tested this one but it should work.
Yeah, actually this always returns "true". I would like to know what`s wrong with it too (if possible).

Anyway, this tut is really useful, since it helped me understand some basic stuff. "Working and learning" seems to be a good startegy :wink:
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

So, does anyone knows what's wrong with it?
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
dudMaN
Posts: 111
Joined: Fri Mar 02, 2007 6:37 pm

Post by dudMaN »

shadowslair wrote:This is a really nice tutorial. Still can be improved though. Adding fixed and working versions of the codes will be really nice. I don`t think that there are much guys so fallen in love with the old versions to use it. :lol:
or, another more "accurate" collision function:
Code:

bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getBoundingBox().intersectsWithBox(two->getBoundingBox())) {
return true;
return false;
}

havent tested this one but it should work.
Yeah, actually this always returns "true". I would like to know what`s wrong with it too (if possible).

Anyway, this tut is really useful, since it helped me understand some basic stuff. "Working and learning" seems to be a good startegy :wink:
Yeah, tested that out on something(dont remember what) and it always returns true. I'm ganna remove that sometime :shock: .

-DudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

But it Should work, doesn't it?
We need to find why it is almost always true (I somehow had few falses in some cases)..
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

You should use ->getTransformedBoundingBox()

Infact, I went over this months ago on IRC with you dudMaN, didn't I?
But it Should work, doesn't it?
No, no it shouldn't, if you dont return the Transformed bounding box, it just gives you one thats always placed at 0,0.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

"Transformed":?:
Could you explain please what do you mean. I guess you're right and I'll try that tomorrow when I get home but I'm not familiar with the term 'Transformed' in relation to graphics.

Thanks.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Transformed to World coordinates. Similar to getAbsolutePosition compared to getPosition.
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

hybrid wrote:Transformed to World coordinates. Similar to getAbsolutePosition compared to getPosition.
:o , Thanks :!:
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Ola
Posts: 1
Joined: Mon Apr 21, 2008 12:09 pm

Post by Ola »

I think (maybe i am wrong) the code should look like this:

bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox())) {
return true;
}
return false;
}
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Ola wrote:I think (maybe i am wrong) the code should look like this:

bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox())) {
return true;
}
return false;
}
That's what BlindSide said :wink: ,
And better be: return if(one->...)
so if it's true it would return true or false otherwise.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
dudMaN
Posts: 111
Joined: Fri Mar 02, 2007 6:37 pm

Post by dudMaN »

BlindSide wrote:You should use ->getTransformedBoundingBox()

Infact, I went over this months ago on IRC with you dudMaN, didn't I?
But it Should work, doesn't it?
No, no it shouldn't, if you dont return the Transformed bounding box, it just gives you one thats always placed at 0,0.
Blindside: thanks.

All the people who clicked the link from tut:

Code: Select all

bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox())) {
return true;
}
return false;
}

-dudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

It`ll be a good idea to replace the buggy with the working code in the first page of the tutorial. It would be best I think... :roll:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Why not:

Code: Select all

bool collision(ISceneNode* one, ISceneNode* two) 
{
return (one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox()));
} 
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

He-he...

I think there are many ways to achieve something, but it will be useless to write down all of these in the tutorial. Let`s say:

TUTORIAL 4: Collision detection

Type this:
(...)
Or this:
(...)
Why not this
(...)
This will do the job too
(...)
An on, and on...

PS:Anyway it`s really nice you found another composition of the solution. :wink:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

MasterGod wrote:
Ola wrote:I think (maybe i am wrong) the code should look like this:

bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox())) {
return true;
}
return false;
}
That's what BlindSide said :wink: ,
And better be: return if(one->...)
so if it's true it would return true or false otherwise.
I suggested it first :? :P lol..
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Post Reply