PDA

View Full Version : Mesh collisions



BlueCat
16-01-2006, 04:03 PM
I want to use a physics library to stack some objects (3DS models) but I can't make them from primitives, this is how they look:

http://indiesoft.co.uk/images/test.png

The objects will never have more than 16 vertices with 16 faces, so it's fairly simple geometry. I'm pretty familiar with ODE and I can't see a way this could be done. Would I be able to use Newton for this?

:cat:

JSoftware
16-01-2006, 05:11 PM
Don't you think that ODE's trimesh could do that for you?
I haven't used ode or newton much though i must regret

BlueCat
16-01-2006, 05:35 PM
Don't you think that ODE's trimesh could do that for you?
I haven't used ode or newton much though i must regret

Well it needs to be trimesh to trimesh collisions and I'm not sure ODE supports that. I have to admit though it's been a while since I used it.

:roll:

technomage
16-01-2006, 06:24 PM
You do have complex shapes there, but in ODE it's not a requirement to have one geomper body, in my app I have one body to handle physics and n number of geoms to define the shape, usually boxes from one of your shape you can define it out of 4 boxes (to make the square with the hollow middle).

OK it's not pixel perfect but it's fast enough got most applications.

BlueCat
17-01-2006, 12:20 PM
Thanks :)

I've had a look at Newton and it seems that I can make a composite collision out of 4 convex hulls, so I've split each model into 4 parts and I'm going to give it a go. I'll let you know how it goes :wink:

BlueCat
17-01-2006, 02:23 PM
Ok I'm loading 4 3DS model parts to make the compound collision. I'm using GLScene so I need to get the vertex data from TGLFreeforms


var CompoundCollision : PNewtonCollision;
Collisions: array[0..3] of PNewtonCollision;
Freeforms: array[0..3] of TGLFreeform;
.
.
.
.
.

Collisions[0] := NewtonCreateConvexHull(NewtonWorld,8,@Freeforms[0].MeshObjects.Items[0].Vertices,3*SizeOf(Single),nil);
Collisions[1] := NewtonCreateConvexHull(NewtonWorld,8,@Freeforms[1].MeshObjects.Items[0].Vertices,3*SizeOf(Single),nil);
Collisions[2] := NewtonCreateConvexHull(NewtonWorld,8,@Freeforms[2].MeshObjects.Items[0].Vertices,3*SizeOf(Single),nil);
Collisions[3] := NewtonCreateConvexHull(NewtonWorld,8,@Freeforms[3].MeshObjects.Items[0].Vertices,3*SizeOf(Single),nil);
end;
CompoundCollision := NewtonCreateCompoundCollision (NewtonWorld,4,@Collisions[0]);


I'm getting an access violation in Newton.dll when the object collides with a box and I think the above code is causing it. Any GLScene/Newton experts with an answer? :lol:

tux
17-01-2006, 07:16 PM
yes this can be done with newton. you can use the collision system without using the dynamics

NecroDOME
08-01-2007, 01:05 PM
Sorry for bringing up this old topic.

I'm trying to use NewtonCreateConvexHull but I also getting an access violation in Newton.dll.

I can create a convex hull, it moves but when it hits anything it just gives an access violation.

Anyway I'm doing something wrong and need a bit of help.