Collision detection

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
Gezmo P
Posts: 16
Joined: Sun Mar 28, 2004 10:01 am
Location: London, UK

Collision detection

Post by Gezmo P »

Hi all.

I am currently trying to implement collision detection and gravity on a 3rd person model. I have managed to get things to work mostly, but my characters feet are sunk slightly into the floor.

I reviewed some old posts and think i have found a discrepancy between old versions and new of irrlicht:

CreateCollisionResponseAnimator used to have an optional 6th param which was a vector3df, but it now only appears to be a float. This used to be used to signify the offset to be used for aligning the collision response to a surface.

Can someone please give some assistance as to what sort of value could go in now to help my poor model find her feet? :wink:

I have tried a -ve value, and my model disappeared (I guess she was pulled through the floor and fell into a bottomless pit), and +ve values which seemed to have no impace whatsoever:

Code: Select all

scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, playerNode, elipsoidSize, core::vector3df(0,-100,0),core::vector3df(0,0,0),200.0f);
The 200.0f is the value I am trying to use...

Many thanks,

Gezmo
"DIIIIIIIIIIIIVVVVVVVVVVVVEEEEEEEEEEEEEEE"
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

First check wheter you use createOctTreeTriangleSelector for your scene. In other case your model will falling down.
Second you can use

Code: Select all

ellipsoidRadius = Node->getBoundingBox().MaxEdge - Node->getBoundingBox().getCenter();
for calculating of ellipsoidRadius.
And third you can manipulate value of ellipsoidTranslation to uplif your node.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
Gezmo P
Posts: 16
Joined: Sun Mar 28, 2004 10:01 am
Location: London, UK

Thanks

Post by Gezmo P »

Thanks for the reply.

I have got my elipsoid to be the correct size (i think) i am now looking to adjust the offset value for the collision response animator. This used to be a vector3df value, but is now just a float value, so i am trying to find out how that value works so I can put in one to raise my models feet so they are on the ground rather than under it.

Gezmo
"DIIIIIIIIIIIIVVVVVVVVVVVVEEEEEEEEEEEEEEE"
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

I thing that you make mistake - see constructors:

irr 07

Code: Select all

virtual ISceneNodeAnimatorCollisionResponse* irr::scene::ISceneManager::createCollisionResponseAnimator  (  ITriangleSelector *    world,  
  ISceneNode *    sceneNode,  
  const core::vector3df &    ellipsoidRadius = core::vector3df(30, 60, 30),  
  const core::vector3df &    gravityPerSecond = core::vector3df(0,-100.0f, 0),  
  f32    accelerationPerSecond = 100.0f,  
  const core::vector3df &    ellipsoidTranslation = core::vector3df(0, 0, 0),  
  f32    slidingValue = 0.0005f 
 )  [pure virtual] 
irr 08

Code: Select all

virtual ISceneNodeAnimatorCollisionResponse* irr::scene::ISceneManager::createCollisionResponseAnimator  (  ITriangleSelector *    world,  
  ISceneNode *    sceneNode,  
  const core::vector3df &    ellipsoidRadius = core::vector3df(30, 60, 30),  
  const core::vector3df &    gravityPerSecond = core::vector3df(0,-100.0f, 0),  
  const core::vector3df &    ellipsoidTranslation = core::vector3df(0, 0, 0),  
  f32    slidingValue = 0.0005f 
 )  [pure virtual]
In ver. 08 only accelerationPerSecond not exist. And ellipsoidTranslation is same vector3df, not float.

Since I can see you change slidingValue in your code, but this is not related with translation.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
Post Reply