Collision Detection ?


19-09-2007 01:21:00

Everything has been pretty straightforward since i started using python-ogre. But now i really dont know what to do. I am trying to implement collision detection. I dont want to use a physics engine ( i dont wanna compicate my project with something i really dont need). I havent seen any good solution, though there is an opcode directory in the python-ogre folder. If i know it well mousepicking is avaible through raycasting. Or it would be much easier to get used to a physics engine? Thanks for any answer


19-09-2007 01:40:44

Yes its much easier to just use a physics engine and then turn off the physics. It will offer be quicker doing low level stuff like this in C.


19-09-2007 01:48:05

I was afraid of that answer but thx for answering it. If using a physics engine how much will it affect animationhandling and scene creating? (Animation especially)


19-09-2007 04:15:24

How were you planning on doing collision detection? If you where going to use a collision library you would face all the same issues with animation and scene creation.

In both cases you need extra data in your scene to record the collision primitives used for each object. Then you have to make sure they stay synced with the animated character. I think some physics engines might already sync primitives to animated bones.


19-09-2007 22:27:03

Ah a think i misunderstood something. Actually i only want collision detection for object picking. I though that turning the physics off would mean that it doesnt alter animations. Staying synced with animated characer? This sound a bit a complicated. Maybe simple opcode would be enough for that???


20-09-2007 04:19:51

Thank you Game_Ender for your help and quick responses. I ve just realized that using physics engines can cause a lot of troubles so i decided not to use them. I have found out that the original ogre tutorials are almost enough for me, so i will try to update the wiki and to translate the tutorials.


20-09-2007 04:29:43

I think that bounding boxes are good enough for most object picking needs. Its important to note the using something like opcode will be similar to a physics engine, after all opcode is what ODE uses for its collision detection.


20-09-2007 06:25:57

You seem to know every answer for my questions. Bounding boxes is what im searching for. But if i want my meshes to interact with the mouse i must use opcode, right? I just want to move animated meshes around my scene with the mouse. So what do you suggest?

I ve updated parts of the wiki (im willing to update it regurarly if its needed). I have two genius friends who are expert in c++ (one of them is at vodafone, the other one is at oracle) so i think i will ask them to help me translating the tutorials. Are the tutorials enough for my plan?


20-09-2007 06:28:30

I have not actually done any object picking or character animating personally, but you should be able to use bounding boxes and ray casts to pick individual objects out of a scene. So if you wanted to just select objects and give them order to move to another object bounding boxes are fine. I believe you need something like opcode to find the contact points on the object itself.


20-09-2007 17:47:51

Perhaps i dont even need opcode, atm it seems that the tutorials are almost enough, so its the first im going to do.


20-09-2007 19:04:42

JeDi posted some code a while back that gives triangle precision raycast picking:

Here are the files:

I think if we looked at how OgreOpcode deals with animated meshes, we might be able to tweak the code to support animated meshes.

Depending on your use, you may find this handy. Especially if you have scenes with lots of various sized entities, where their bounding boxes will overlap.


21-09-2007 02:49:34

Check out in the demos/opcode directory as this shows how to use the Ogre collision detection- IntersectionQuery - (which seems to work OK)..

Also the RayCasting demo in the OgreNewt demo directory shows how to pick an object...



21-09-2007 18:52:05

Thank you guys. You ve been very helpful. Now i think i know what to do. BTW: how could that be some meshes are already skinned as i load them into my scene? The ones i ve exported from blender and 3ds are always white.


14-11-2007 16:01:35

Thank you guys. You ve been very helpful. Now i think i know what to do. BTW: how could that be some meshes are already skinned as i load them into my scene? The ones i ve exported from blender and 3ds are always white.

Hey, I found a question that I can help with! It's a little late, but I'm going to throw in my .02 anyway.

The default texture is what I refer to as "blinding white". If PO doesn't find a material with a valid texture file that's applied correctly, it'll automatically go to whatever your default is. Most likely, you're exporting your materials as Orco, not UV-mapped. You'll want to set up your textures with a texture file (an image, even if it's 1px x 1px) and map it onto your object (Blender is pretty easy to do this with, if you're familiar with the basics of the interface). Let me know if you need any help. I've noticed that python-ogre and ogre artists don't communicate nearly as well as code developers, and I'd be happy to help any way that I can.

You may also want to post your .mesh file, so we can see exactly what's going on.