SONB
Member
|
PhysPart::createConvex(...) from a Mesh?
Hi, Esenthel.
Is it possible to create a convex body from a Mesh? I tried to do so with my ship but the method createConvex() gives me an error ("Error: PhysPart::createConvex()").
My code:
Code:
Mesh mesh;
mesh.load("obj/ships/capsule/capsule.mesh");
MeshPart &mpart=mesh.part(0);
Mshb &mshb=mpart.base;
PhysPart pp;
pp.createConvex(mshb);
Thanx in advance!
|
|
04-16-2009 12:43 AM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
this will work in the next engine release (please hold on for the new version, possibly tommorow)
currently createConvex assumes that the Mshb is already in convex form, in the next version it will not make such assumption
|
|
04-16-2009 12:55 AM |
|
SONB
Member
|
Re: PhysPart::createConvex(...) from a Mesh?
Oh, ok, I can wait
Tried to create a body with multiple physics shapes but it doesn't work because I raycast it for my sun effect, and for this purpose the ship must have a detailed physics body. -> That's why I need a convex body.
I hope, it will be ready tomorrow.
Anyway, thanx a lot!
|
|
04-16-2009 01:07 AM |
|
haojiezhu
Member
|
Re: PhysPart::createConvex(...) from a Mesh?
Very excited. Can't wait to see the new version.
|
|
04-17-2009 04:59 PM |
|
SONB
Member
|
Re: PhysPart::createConvex(...) from a Mesh?
Esenthel, I'm still getting "Error: PhysPart::createConvex" both in Mesh Editor and in my code :( .
|
|
04-18-2009 12:06 AM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
Um, maybe the mesh is too complicated for PhysX.
It's hard to say, could you send me the mesh which cauese these errors?
I've tested creating the Convex mesh on few meshes, and it all worked fine.
|
|
04-18-2009 12:56 AM |
|
SONB
Member
|
Re: PhysPart::createConvex(...) from a Mesh?
Ok, I'll send you my mesh.
I don't think it's the complexity. I tried to make a convex mesh from your barrel, with the same error.
|
|
04-18-2009 01:01 AM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
Thanks, I'm investigating this right now
|
|
04-18-2009 02:00 PM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
Yes it is I suspected, it's because of the mesh complexity and PhysX can't handle those convex meshes.
I'll change the Mesh Editor behavior and instead of exiting to show a message "mesh too complex"
Your model is fairly simple, you can easily use a capsule for your object.
Remember also that you can create the body from multiple shapes.
You can also try with convex, but for now you would need to simplify the model before creating the convex. I'll see if I can do something about it (auto simplification for Convex).
|
|
04-18-2009 02:40 PM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
Ok, I've developed an algorithm which manually creates convex meshes and optionally limits the vertexes number so the PhysX will be able to handle. It will be in the next SDK.
For the ship I advise using Capsule optionally with some other shapes, shapes are always faster than Convex
|
|
04-18-2009 05:50 PM |
|
SONB
Member
|
Re: PhysPart::createConvex(...) from a Mesh?
Sorry, Esenthel, but simplifying doesn't solve the problem.
I made a simple sphere in Blender (16x16 sectors), scaled it to make it look like my ship, exported as .OBJ, imported in Mesh Editor->create convex... Failed :(
I don't know how simple must the mesh be to be able to create a convex from... It's weird, because I could create a convex from your human.mesh and I don't think that my ship.mesh or this sphere I made in Blender are more complex than the human.mesh :?
Anyway, I'll try to export more simplier shapes from Blender and create convex from them.
|
|
04-18-2009 05:51 PM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
It matters only the output number of vertexes, for example the human has lots of input vertexes, but after the creation of the convex the convex if pretty simple.
However creating convex from your ship and barrel produces much more complex convex results. which physx cant handle.
But read my post above, it's everything written there
P.S. spheres are actually the most complex shapes for convex creation.
|
|
04-18-2009 05:54 PM |
|
SONB
Member
|
Re: PhysPart::createConvex(...) from a Mesh?
Esenthel Wrote:It matters only the output number of vertexes, for example the human has lots of input vertexes, but after the creation of the convex the convex if pretty simple.
Oh... NOW I get it
Esenthel Wrote:Ok, I've developed an algorithm which manually creates convex meshes and optionally limits the vertexes number so the PhysX will be able to handle. It will be in the next SDK.
Well this would be awesome!
Esenthel Wrote:For the ship I advise using Capsule optionally with some other shapes, shapes are always faster than Convex
Ok, I'll give it one more try.
One question: is it a PhysX limitation that we can't squeeze spheres in ME? I mean, it would so much better for me to create a perfect body for my ship, just make a sphere, squeeze it on two sides, done!
|
|
04-18-2009 06:15 PM |
|
Esenthel
Administrator
|
Re: PhysPart::createConvex(...) from a Mesh?
Well a squeezed ball isn't a ball both Esenthel Engine and PhysX don't support squeezed balls.
a Capsule would be more like it.
|
|
04-18-2009 06:18 PM |
|