Finding a node that an object collided with?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

ToDo List:

Post by schick »

ToDo base classes:

ICollisionManager:
- more configuration options (during runtime)

ICollisionNode:
- more configuration options (during runtime)
- add more body types
( - do something like joints)

Handling that except the joint stuff should not be a big deal. The next step is to set up some CollisionSceneNodes.

ToDo CollisionSceneNodes:

CCollBullet:
- collision cube type
- not affected by gravity
- does not response on collision (but takes the event)
- does not render itself

CCollRocket:
- collision cube type
- not affected by gravity
- does not response on collision (but takes the event)
- renders an IAnimatedMesh

CCollGranateCube:
- collision cube type
- collision is calculated with a different material type (not bouncing back like a ball)
- renders an IAnimatedMesh

CCollGranateSphere:
- collision sphere type
- collision is calculated with a different material type (not bouncing back lik a ball)
- renders an IAnimatedMesh

CCollPlayer:
- collision cube type
- collision is calculated without any type of rotation
- collision should check for stairs
- collision material is updated (players should not bounce like a ball)
- renders an IAnimatedMesh

CCollPlayerCamera:
- collision cube type (same as player but camera is attached to it)
- collision is calculated without any type of rotation
- collision should check for stairs
- collision material is updated (cameras should not bounce like a ball)
- renders nothing

CCollMap // (with terrain)
- collision tree type
- not affected by any type of collision
- renders an octree scenenode
- sets up the world coordinates

CCollSphere:
// the name tells it all

CCollCube:
// the name tells it all

If you think there are any more needed CollisionSceneNodes post them here. I hope to make them working within the next weeks. But keep in mind ill have to do lots of work (having my exams (Abitur) at school) so there wont be much freetime. The first thingy is to make the base classes stable enough. The CollisionSceneNodes do only require to rewrite 2 - 4 methods.
Guest

Re: woohoo

Post by Guest »

schick wrote: http://www.bluffel.de.vu/files/NewtonPhysic_bin.rar

The src (keep in mind you need to have newton sdk and the irrlicht sdk installed):

http://www.bluffel.de.vu/files/NewtonPhysic_src.rar
I tried downloading them, but get 404 (or one time, the RAR displayed in my browser as text). Is your server overloaded? Wrongly configured?

Code: Select all

--17:45:35--  http://www.bluffel.de.vu/files/NewtonPhysic_src.rar
           => `NewtonPhysic_src.rar'
Resolving 127.0.0.1... done.
Connecting to 127.0.0.1:8118... connected.
Proxy request sent, awaiting response... 404 Not Found
17:45:35 ERROR 404: Not Found.
Cheers,

Tels
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

I do not have a problem...

Post by schick »

try to download them that way:

http://www.bluffel.de.vu/files/
Liamx

Post by Liamx »

Wow! I've seen your demo and it's great! You are doing an excellent work.

Now I would like to try to make something from a blank project in vc++.
I mean, using Irrlitch is easy, just include a .h and link to a lib and put a dll next to the executable file.
With your collision system, what do I have to do? Because I didn't found a lib or a dll. How can I use your system from a blank project?

Sorry if this is a silly question.
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

I have uploaded a new version of the collision system. It is now able to handle normal IMesh objects. There is a little problem handling sphere rigidbodies at the moment (not really a big deal it think).

http://www.bluffel.de.vu/files/
Liamx wrote: I mean, using Irrlitch is easy, just include a .h and link to a lib and put a dll next to the executable file.
Well, download the NewtonSDK http://www.physicsengine.com/ and install it. Now just include the lib and header paths of the NewtonSDK in your VisualC++ IDE as you did for irrlicht.

The probably easiest way to use my code is to open the project file and delete the main.cpp all other files are needed!. So you have a blanc project. You may want to copy the Newton dll somewhere in your system32 directory.
Guest

Post by Guest »

Ok, I will use your demo as a template then.
schick wrote:I have uploaded a new version of the collision system. It is now able to handle normal IMesh objects. There is a little problem handling sphere rigidbodies at the moment (not really a big deal it think).
In your demo I tried to use the room map that is in one of the Irrlicht's examples, but the console hungs up as if it were in an infinite loop.
I only made this change in the main.cpp:

//IAnimatedMesh* mesh = smgr->getMesh("data/physicstest.bsp");
IAnimatedMesh* mesh = smgr->getMesh("data/room.3ds");

I tried with a very simple map (ms3d extension) that I made with MilkShape, and it hungs up too. I tried to view it with normal Irrlicht and it worked.
Is bsp the only format supported? Or am I doing something wrong?
If bsp is the only format supported, can you tell me which editor you use to make bsp. Because I want to make some maps.
Thanks.
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

Yeah, the map is supposed to be saved in a OctTree so only bsp are supported at the moment. If you could send me your map file i can try to make it work using the IMesh scenenode. E-mail: Friedrich.Schick@web.de

Here is a thread about making bsp maps:

http://irrlicht.sourceforge.net/phpBB2/ ... +map#10515

At the moment i am working to get the base collision scenenodes working. After doing that ill add the specific extension as i wrote before (granades etc.).
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Re: ToDo List:

Post by Robomaniac »

[quote="schick"]
If you think there are any more needed CollisionSceneNodes post them here. quote]

CCollRagdoll ;-)

just a CCollPlayer with joint information and an enable flag (for turning on the ragdoll)

;-)
The Robomaniac
Project Head / Lead Programmer
Centaur Force
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

Well, sphere collision is now working. But i realized a not-realy-bad design issue if you want to use different collision materials. The next step is now to fix that design issue (not a big deal i think).

I won't release any binary demos upto the next major release, do not want to pay for traffic :-(.
Robomaniac wrote: CCollRagdoll
Whats a ragdoll? Joint handling will be the last thingy added. First i have to set up all scenenodes needed in common.
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

hmm, i had misunderstood the _importance_ of materials. So far so good the implementation will take some thinking, because of its importance. But i have some ideas about it.

To make it clear to you:

In short:

If you have a real good implementation of materials, you save about ~80% of AI coding.

The long version:

Materials have some attributes as friction, elasticity. Well, nothing important yet. But in fact you can set that friction between each material type in a different way and the physic engine handles now all objects automatic.

No, wow? Need example? Think of 3 material types (groups)

1. human
2. wall
3. explotion

human + wall //nothing
human + explotion //the human flies away
human + human //nothing

wall + explotion //nothing
wall + wall // doesnt exist, wall is not able to move
explotion + explotion //nothing

You just have to write some functions telling what happens between different material types (at initialization), thats it (see above). Everything now goes automatic (for any extra stuff, the event handling is still alive). Adding another material group doesnt make a big afford.

If you do it the old way, switch through all object types and add a specific AI code for every object type (more work because you have to look for velocity etc.). If you now add another object, you have to expand the switch statement on every node (lots of work).

After i have finished thinking about the material thingy ill publish it and everybody is allowed to (should :-)) improve my design.
Mercior
Posts: 100
Joined: Tue Feb 24, 2004 1:53 am
Location: UK
Contact:

Post by Mercior »

Looking good schick, though the collisions seem a little buggy.

My tutorial really needs updating :) I've learned a lot since I wrote it. The first thing I notice is in createStaticMeshNodeFromMesh:

Code: Select all

NewtonTreeCollisionEndBuild( Collision, 0);
I really advise you change that 0 to a 1, so that newton will optimise the collision mesh - it will give a big performance boost. Also in createStaticMeshNodeFromMesh, it casts to a 2T vertex type which is why somebody has posted above that it does not work with the .3ds level - this would need to be a (S3DVertex) cast to work with non-bsp meshes. You could write some code to check what type of vertex is in the mesh buffer and cast appropriately :)

You may also wish to either scale down the irrlicht units (Personally I divide them by 128 before passing to newton) or adjust friction, elasticity, etc values to match the large unit scale irrlicht uses - this should make the collisions smoother and stop boxes from jumping around when stacked on top of each other.
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

Well, everything begun with your tutorial :-).

Ill fix that S3DVertex-2TVertex thing when i got some sparetime (if you did so send me the code in, ill update it). But my priority lies down the core design, the material thingy. After finishing those design issue ill start writing the "useful" stuff.

As you just mentioned, i really do learn more every time i read through the function documentation (i love to see the docu to be as good as the irrlicht docu, its a kind of bad :-( ).
Rat
Posts: 51
Joined: Wed Mar 10, 2004 7:05 am

Post by Rat »

schick, did anyone give you a mesh to work with instead of bsp? I can let you have my castle scene that includes terrain that I have working in the Mecior code example. If so, email me about it at rat AT drawcad DOT com
The above was written like it is so that bots and spam a lots will detect the addy :D
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Is it possible to collide world with any mesh object (not just spheres and blocks)?
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

puh wrote: Is it possible to collide world with any mesh object (not just spheres and blocks)?
The only "mesh collision bodies" you can take are static. Therefore you cannot make them move or behave in a certain way (only effect other object using the material stuff).
Post Reply