FunCollision v1.0 Source + Bin + Tutorials
-
- Posts: 6
- Joined: Tue Jan 25, 2011 8:34 pm
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
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. 
Just keep in mind that switching samplers can lead to issues, unless the entity is in open air.

Just keep in mind that switching samplers can lead to issues, unless the entity is in open air.

"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
-
- Posts: 6
- Joined: Tue Jan 25, 2011 8:34 pm
Wow! Fast reply!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.
Just keep in mind that switching samplers can lead to issues, unless the entity is in open air.

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
-
- Posts: 6
- Joined: Tue Jan 25, 2011 8:34 pm
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?
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?
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
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".
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".

"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
-
- Posts: 6
- Joined: Tue Jan 25, 2011 8:34 pm
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...
Thanks anyway. I'm gonna keep working at it. I'm sure it's something stupidly obvious I didn't notice before...
-
- Posts: 6
- Joined: Tue Jan 25, 2011 8:34 pm
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
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: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.
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.demonicpancake wrote:And if I want to create a projectile that isn't hit scan, what's the best way to do that?
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
-
- Posts: 6
- Joined: Tue Jan 25, 2011 8:34 pm
And how exactly would you do that? Sorry, I'm a noob.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.
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?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.
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
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.
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..."
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
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..."
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria