FunCollision v1.0 Source + Bin + Tutorials

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
demonicpancake
Posts: 6
Joined: Tue Jan 25, 2011 8:34 pm

Post by demonicpancake »

First off, thanks for this library.

One issue I ran into is if you change samplers it doesn't maintain speed due to gravity. Any way to get around that?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

In "CCollEntity::setSampler(ICollSampler* Sampler)" you can simply replace the "spawn(pos);" with a "teleport(pos);"- call. This will maintain its velocities/forces/impulses/gravity etc. :wink:

Just keep in mind that switching samplers can lead to issues, unless the entity is in open air. :P
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
demonicpancake
Posts: 6
Joined: Tue Jan 25, 2011 8:34 pm

Post by demonicpancake »

shadowslair wrote:In "CCollEntity::setSampler(ICollSampler* Sampler)" you can simply replace the "spawn(pos);" with a "teleport(pos);"- call. This will maintain its velocities/forces/impulses/gravity etc. :wink:

Just keep in mind that switching samplers can lead to issues, unless the entity is in open air. :P
Wow! Fast reply! :)

Worked like a charm! And yeah I'm changing samplers so my player can crouch. What would happen is you could crouch and stand up repeatedly to slow your falling through the air. Kinda weird.

Thanks
demonicpancake
Posts: 6
Joined: Tue Jan 25, 2011 8:34 pm

Post by demonicpancake »

Hmm, my terrain isn't working. I'm falling right through it. I'm creating my terrain as such:

terrain = client->scenemgr->addTerrainSceneNode(s.c_str(),0,1,pos,rot,scale);

And the collision stuff:

CCollTerrainSelector* terrainSelector = collMgr->addTerrainSelector(terrain,2);
terrainSelector->build();
collMgr->addObject(terrainSelector,terrain);

What am I doing wrong?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

You`re falling through your terrain visual representation, not through its collision mesh. Creation code seems ok. My guess is that there`s some transforming issue if you transform your terrain node afterwards.
For the test try the LOD 0 to get 1:1 collision with "graphics" mesh and you should definitely try drawing the collision mesh by keeping the terrain coll object pointer and calling "obj->drawDebugData(driver);" (in the place you usually draw stuff manually like text, lines etc. For this you can use the 2nd LOD if the framerate is very low ) . Then take a little look-around-walk to see where actually is your terrain- should appear in cyan. If the two are matching, then you better check your collision entity being a "ghost". :D
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
demonicpancake
Posts: 6
Joined: Tue Jan 25, 2011 8:34 pm

Post by demonicpancake »

First off, I'm not transforming the node after creation so that shouldn't be a problem. I already tried LOD 0 and (after waiting forever to load) it still doesn't work. The drawDebugData() didn't work either because I don't see a cyan mesh anywhere. And I know it's not a "ghost" because I can collide with other things still.

Thanks anyway. I'm gonna keep working at it. I'm sure it's something stupidly obvious I didn't notice before...
demonicpancake
Posts: 6
Joined: Tue Jan 25, 2011 8:34 pm

Post by demonicpancake »

What's the best way to check collision for a bullet? I want either bounding box checking or triangle checking and all I can figure out is how to check against my ellipsoid samplers with a ray.

And if I want to create a projectile that isn't hit scan, what's the best way to do that?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

demonicpancake wrote:What's the best way to check collision for a bullet? I want either bounding box checking or triangle checking and all I can figure out is how to check against my ellipsoid samplers with a ray.
I`m afraid at the moment you cannot raycheck against your coll entities` triangles or bboxes the way Irrlicht does in the 07.Collision example. Of course at least for the ray-aabbox you can easily make it yourself.
demonicpancake wrote:And if I want to create a projectile that isn't hit scan, what's the best way to do that?
Not really sure what you mean, but you can create a projectile and use coll entity for it- say a sphere. If the projectile is a rocket for example and you don`t want it to be affected by gravity, easiest way to do it is to call myRocketProjectileEntity->resetGravity(); manually each step.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
demonicpancake
Posts: 6
Joined: Tue Jan 25, 2011 8:34 pm

Post by demonicpancake »

I`m afraid at the moment you cannot raycheck against your coll entities` triangles or bboxes the way Irrlicht does in the 07.Collision example. Of course at least for the ray-aabbox you can easily make it yourself.
And how exactly would you do that? Sorry, I'm a noob.
Not really sure what you mean, but you can create a projectile and use coll entity for it- say a sphere. If the projectile is a rocket for example and you don`t want it to be affected by gravity, easiest way to do it is to call myRocketProjectileEntity->resetGravity(); manually each step.
I tried to use a coll entity for it but it would collide with the player when it was shot. Then it would like jump on top of the player and go from there. Perhaps a better question is, is there any way to prevent certain objects from colliding with each other?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

For the ray-box check I advise you to google it a bit or if you`re really lazy or cannot find anything, you can always take a look at the irr source in "void CSceneCollisionManager::getPickedNodeBB(bla-bla)". It`s a bit messy at first look, but it works and is a ray-obb check.

About the projectile problem- probably the best way would be to add collision groups and before the broad phase you check whether an entity can collide with another one and if it cannot, to skip it or sth similar.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
VeTaL
Posts: 14
Joined: Mon Feb 21, 2011 8:39 am

Post by VeTaL »

Hi, guys... Looking like the link is broken :?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Hi, VeTaL. Here`s a new link: http://www.mediafire.com/?gp3pb5uiaz3776c
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
VeTaL
Posts: 14
Joined: Mon Feb 21, 2011 8:39 am

Post by VeTaL »

Thanks for fast reply :)
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Post by Dareltibus »

the link is broken :(
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Dareltibus wrote:the link is broken :(
You`re too fast to post, and not reading enough. The initial is dead, but the one I posted should work fine.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Post Reply