A forum to store posts deemed exceptionally wise and useful
shadowslair
Posts: 758 Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria
Post
by shadowslair » Fri Apr 04, 2008 7:30 pm
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.
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
MasterGod
Posts: 2061 Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:
Post
by MasterGod » Wed Apr 09, 2008 6:29 am
So, does anyone knows what's wrong with it?
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 » Sat Apr 19, 2008 7:35 pm
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.
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
Yeah, tested that out on something(dont remember what) and it always returns true. I'm ganna remove that sometime
.
-DudMan
MasterGod
Posts: 2061 Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:
Post
by MasterGod » Sun Apr 20, 2008 3:30 pm
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)..
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 » Sun Apr 20, 2008 3:48 pm
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 » Sun Apr 20, 2008 4:06 pm
"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.
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 » Sun Apr 20, 2008 8:31 pm
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 » Mon Apr 21, 2008 9:58 am
hybrid wrote: Transformed to World coordinates. Similar to getAbsolutePosition compared to getPosition.
, Thanks
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 » Mon Apr 21, 2008 12:10 pm
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 » Mon Apr 21, 2008 8:51 pm
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
,
And better be: return if(one->...)
so if it's true it would return true or false otherwise.
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 » Tue Apr 22, 2008 10:20 pm
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
shadowslair
Posts: 758 Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria
Post
by shadowslair » Wed Apr 23, 2008 6:59 am
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...
"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 » Wed Apr 23, 2008 7:12 am
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 » Wed Apr 23, 2008 12:41 pm
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.
"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 » Wed Apr 23, 2008 7:08 pm
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
,
And better be: return if(one->...)
so if it's true it would return true or false otherwise.
I suggested it first
lol..
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%