entity movement + collision

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Sean H.
Posts: 21
Joined: Mon Aug 06, 2007 12:25 am

entity movement + collision

Post by Sean H. »

I'm not sure how this can be implemented in irrlicht. I would like to get a basic character which can move and collide with the environment. I know there's an elementary setposition function and theoretically, any type of movement or collision system can be written based off that, but I'm curious about how to use irrlicht's built-in animators to do the job.

In the examples I've seen, the collisionResponseAnimator is only applied to the fps camera which moves automatically based on user input. the flyStraightAnimator is only used for a mesh which doesn't seem to really interact or collide with the environment. using setposition, in conjunction with an animator seems counterproductive as one will probably override or overwrite the other. what I'm looking for is the common sense way of having a moving object which is influenced by gravity and collides with the environment. is it possible to use a collisionResponseAnimator along with a flyStraightAnimator for this? how can this be done?
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

well apply the collistion respomse to the mesh like the camera !!
or u could use the tile based system that doesnt need collistion system :P
Sean H.
Posts: 21
Joined: Mon Aug 06, 2007 12:25 am

Post by Sean H. »

I probably will end up using the collision response animator, the question is how do I then move the mesh? from what I've seen, there isn't a general 'move' function which will work in conjunction with the collision response animator. the only facilities for moving a mesh is setposition() and flyStraightAnimator. I dont think either of these are designed to work in conjunction with the collision response animator. correct me if I'm wrong about any of this...
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

Sean H. wrote:I probably will end up using the collision response animator, the question is how do I then move the mesh? from what I've seen, there isn't a general 'move' function which will work in conjunction with the collision response animator. the only facilities for moving a mesh is setposition() and flyStraightAnimator. I dont think either of these are designed to work in conjunction with the collision response animator. correct me if I'm wrong about any of this...
u are wrong because these 2 work with the collistion animator so the collistion animator will work with setpostion and with flyscene animator
Sean H.
Posts: 21
Joined: Mon Aug 06, 2007 12:25 am

Post by Sean H. »

Ok. Just so I can be sure Im understanding this correctly, let's say I have an airplane. I give the airplane a flyStraightAnimator, and a collisionResponseAnimator. I set the flyStraightAnimator so that it flies from point A to point B high up in the air. Will the collisionResponseAnimator make the plane fall due to gravity such that it ends up flying to a point below point B?
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

Sean H. wrote:Ok. Just so I can be sure Im understanding this correctly, let's say I have an airplane. I give the airplane a flyStraightAnimator, and a collisionResponseAnimator. I set the flyStraightAnimator so that it flies from point A to point B high up in the air. Will the collisionResponseAnimator make the plane fall due to gravity such that it ends up flying to a point below point B?
yes but u can disable gravity and if the point b is on the ground so the gravity will not affect
Sean H.
Posts: 21
Joined: Mon Aug 06, 2007 12:25 am

Post by Sean H. »

coolness! :P

thanks omar. I only want an ai character which will walk along the terrain. sounds like I can do this using a flyStraight animator in combination with a collision response animator.
Sean H.
Posts: 21
Joined: Mon Aug 06, 2007 12:25 am

Post by Sean H. »

Ok after searching the forums and looking through the API a bit, I came across another function:

irr::scene::ISceneCollisionManager::getCollisionResultPosition ()

this function seems perfect for what I need; sliding collision under the influence of gravity and an intial impulse. Ive read in as few threads that people have trouble with terrain collision on inclines using the regular collision animator. is using this function any different from or better than using the regular collisionResponseAnimator? any kind feedback would be appreciated.
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

ya it is more accurate and depends on a better tech but in my own opinioni think it will slow the application a little bit
Post Reply