MogreNewt - 'internal' Collision


21-05-2009 21:44:15

I'm fairly new to using physics and newton and this probably small thing has got me stumped.
I'm trying to setup world collision (where entities interact with each other) on the inside of a mesh, the faces of the mesh were inverted but I've got no clue how to set it up for newton to understand :?

To further clarify, think of something along the lines of a cylinder with objects inside it rolling around.

I can get normal objects colliding and interacting no problem, just this inverse one that's causing my confusion.

For reference I'm using Mogre 1.6.2 and MogreNewt

Thanks for your time,



22-05-2009 11:37:21

maybe it works with ConvexHull:

MogreNewt.CollisionPrimitives.ConvexHull colHull =
new MogreNewt.CollisionPrimitives.ConvexHull(myWorld, mySceneNode, collisionHullTolerance);
// the last param is only for Newton 2, remove it if you use Newton 1.x
myBody.Collision = colHull;


22-05-2009 14:59:21

Thanks Beauty,
I gave that a go but it doesn't seem to be working either.

Dim col3 As CollisionPrimitives.ConvexHull
col3 = New CollisionPrimitives.ConvexHull(physworld, tubeNod, 0)
tubeBod = New Body(physworld, col3)
tubeBod.SetPositionOrientation(tubeNod.Position, Quaternion.IDENTITY)
tubeBod.SetMassMatrix(0.0F, New Mogre.Vector3(1.0F, 1.0F, 1.0F))
tubeBod.MaterialGroupID = physworld.DefaultMaterialID
tubeBod.AutoSleep = False
tubeBod.IsAsleep = False
tubeBod.IsGravityEnabled = False

and variations with it with a mass, without a mass, with it as a box, cylinder :roll: no change :D

(collisions do occur on the outside of the mesh)


22-05-2009 17:17:10

You have to define a Mass > 0.
Otherwise you don't get a collision detection result.

Also call World.CollisionUpdate() or in you case: physworld.CollisionUpdate()
Calling this (e.g. every frame), Newton makes a check.
(This is only available on Newton 2 and needed if you move objects without Newton physics. (using Body.SetPositionOrientation(...) ) )

In the wiki I wrote some information about collision detection. Maybe it helps. ... ith_Newton


22-05-2009 19:28:08

Also try out the newton debugger.
This can show you the position/orientation and state value of objects.
Look to the code snippet on the bottom of the wiki page (linked above) to see how to do.

If your tubeNod isn't attached directly to the RootSceneNode, then you have to use the WorldPosition and WorldOrientation instead.
(Note: In Ogre 1.6 they are renamed to _derivedPosition or similar.)


22-05-2009 22:51:01

I have tried using it with a mass and it had no effect on the functionality I'm after from it (the object still bounces off of it from the outside with or without mass, but not when hitting from the inside) Sorry, I forgot to say I perform the updates each frame too.

If there's no in built way to invert the collision shape, would there be any other way to do it perhaps?


22-05-2009 23:45:12

When the mass is 0 then for Newton it's an infinity mass. So Newton doesn't check it for moves (even it's done manually).
I suppose at your application it works, because one object of the crash has a mass > 0.

Your problem is strange to me. The inversion is only related to the visibility of a surface.
For a Newton collision this doesn't matter, because only the vertices are from interest (for ConvexHull - for others maybe also the triangles).

Please ask the problem in the OgreNewt forum again.
Because this seems not to be a Mogre related question. Here are not much people and more less who know about Newton.
But in the OgreNewt forum are much more people who could help you.
If you got the solution, please post it (or give us the link to the other post).

OgreNewt forum:

* are you shure you defined a MaterialPair for the related body materials?
* will the callback function called? If yes, maybe the code inside is wrong.


23-05-2009 00:30:52

It's not exactly the collision that I can't detect, it's Newtons behaviour on bodies that isn't doing what I'm hoping it should do. Like on the demo's when you fire a block at other blocks, they react to each other depending on the force etc without any additional setup. If I was manually checking it should be ok even from behind, the effect I'm after is something where Newton reacts to the inner 'wall' of the tube and then bounces my block off of it (think light through a fibre optic cable) The only solution I can think of is to do the reaction manually on the callback, but I would have expected something to already exist.

I did wonder if this would be the wrong section :D I might take this to the Newton forums as well; hate creating multiple posts, it's messy :wink:


19-12-2009 23:54:55

As I know newton do care about normal of a triangle.
If your tube is static just invert faces of a mesh and do newton collision tree.
If dynamic you have to cut it into convex shapes and use something like compound collision.

Just can't imagine how could you use ConvexHull on something like inner side of a tube.
However I look at it I just can't find any "Convex" in such a shape.

I stumbled upon this topic. Time has passed.
I just don't like unresolved threads.