Page 3 of 5

Posted: Fri Apr 04, 2008 7:30 pm
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:

Posted: Wed Apr 09, 2008 6:29 am
by MasterGod
So, does anyone knows what's wrong with it?

Posted: Sat Apr 19, 2008 7:35 pm
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

Posted: Sun Apr 20, 2008 3:30 pm
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)..

Posted: Sun Apr 20, 2008 3:48 pm
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.

Posted: Sun Apr 20, 2008 4:06 pm
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.

Posted: Sun Apr 20, 2008 8:31 pm
by hybrid
Transformed to World coordinates. Similar to getAbsolutePosition compared to getPosition.

Posted: Mon Apr 21, 2008 9:58 am
by MasterGod
hybrid wrote:Transformed to World coordinates. Similar to getAbsolutePosition compared to getPosition.
:o , Thanks :!:

Posted: Mon Apr 21, 2008 12:10 pm
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;
}

Posted: Mon Apr 21, 2008 8:51 pm
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.

Posted: Tue Apr 22, 2008 10:20 pm
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

Posted: Wed Apr 23, 2008 6:59 am
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:

Posted: Wed Apr 23, 2008 7:12 am
by BlindSide
Why not:

Code: Select all

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

Posted: Wed Apr 23, 2008 12:41 pm
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:

Posted: Wed Apr 23, 2008 7:08 pm
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..