Any easy way to check for collision?
Any easy way to check for collision?
I'm working on a jumping animation, and I need it only be possible when the player is standing on something. I'm using the CollisionDetectionAnimator, but gravity is set to 0 and is done otherwise, so isFalling() will not work. Besides that, is there any way to see if my character and his ellipsoid are colliding with my metaselector?
Code: Select all
// Irrlicht collision [FOR MAP]
selector = smgr->createOctTreeTriangleSelector(map->getMesh()->getMesh(0), map, 128);
map->setTriangleSelector(selector); // set the map's collision tri grabber
selector->drop(); // drop it as we wont need it anymore
// Irrlicht collision [FOR P1]
ISceneNodeAnimator* anim =
smgr->createCollisionResponseAnimator(selector, p1->getNode(), core::vector3df(30,2,30),
core::vector3df(0,-4,0),
core::vector3df(0,0,0));
p1->getNode()->addAnimator(anim); // add the gravity/collision response animator
anim->drop(); // we dont need the animator anymore
for jumping, just set a timer after they jump for the first time, and they cant jump until that expires. used it for my mario game, works good for me
-dudMan
No, I'm sorry, I think you misunderstood. I have working collision, I don't have any problem there. What I need is a way to return a value or something based on collision, so I can use it in "if" statements.
I can't use a timer because then the player would still be able to jump in the air.
Thanks for you help either way though!
I can't use a timer because then the player would still be able to jump in the air.
Thanks for you help either way though!
Part of my tutorial is on "if statement" collision detection:
http://irrlicht.sourceforge.net/phpBB2/ ... p?p=136776 - Look at chapter 5
-dudMan
http://irrlicht.sourceforge.net/phpBB2/ ... p?p=136776 - Look at chapter 5
-dudMan
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
sorry im new using irrlicht why i have these errors
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(195) : error C2065: 'p1' : undeclared identifier
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(195) : error C2227: left of '->getNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(198) : error C2227: left of '->getNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(198) : error C2227: left of '->addAnimator' must point to class/struct/union/generic type
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(195) : error C2065: 'p1' : undeclared identifier
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(195) : error C2227: left of '->getNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(198) : error C2227: left of '->getNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\ertae\desktop\pixel\test2\test2\test2.cpp(198) : error C2227: left of '->addAnimator' must point to class/struct/union/generic type
Err, probably not only new to Irrlicht, but programming in general.
This snippet is nothing you can just copy/paste in your project and expect to work. You need to change it according to your needs. In this case you need to exchange placeholder p1 with an instance of whatever is your GO type.
And you need to actually *understand* what it does!
This snippet is nothing you can just copy/paste in your project and expect to work. You need to change it according to your needs. In this case you need to exchange placeholder p1 with an instance of whatever is your GO type.
And you need to actually *understand* what it does!
right, this depends on all codes, especially for the tutorials !!!Saturn wrote:This snippet is nothing you can just copy/paste in your project and expect to work.
don't try to only get them to work, but also try to learn what they do (how something is done) !!!
only copy/paste and get them to work doesn't get you further and is not the intention of them !!!
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
EDIT: Sorry, didnt read the entire thread.
Read my 2nd post over, in there is a perfectly working collision function
Read my 2nd post over, in there is a perfectly working collision function
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898