About Store Forum Documentation Contact



Post Reply 
PhysPart::createConvex(...) from a Mesh?
Author Message
SONB Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
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
Find all posts by this user Quote this message in a reply
SONB Offline
Member

Post: #3
Re: PhysPart::createConvex(...) from a Mesh?
Oh, ok, I can wait smile
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
Re: PhysPart::createConvex(...) from a Mesh?
The new version will be delayed by 1 (maximum 2 days) because I'm adding some new cool features which require additional testing smile
04-17-2009 12:37 PM
Find all posts by this user Quote this message in a reply
haojiezhu Offline
Member

Post: #5
Re: PhysPart::createConvex(...) from a Mesh?
Very excited. Can't wait to see the new version.
04-17-2009 04:59 PM
Find all posts by this user Quote this message in a reply
SONB Offline
Member

Post: #6
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
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
Find all posts by this user Quote this message in a reply
SONB Offline
Member

Post: #8
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
Re: PhysPart::createConvex(...) from a Mesh?
Thanks, I'm investigating this right now
04-18-2009 02:00 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
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 smile
04-18-2009 05:50 PM
Find all posts by this user Quote this message in a reply
SONB Offline
Member

Post: #12
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #13
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 smile

P.S. spheres are actually the most complex shapes for convex creation.
04-18-2009 05:54 PM
Find all posts by this user Quote this message in a reply
SONB Offline
Member

Post: #14
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 smile

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 smile
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! smile
04-18-2009 06:15 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #15
Re: PhysPart::createConvex(...) from a Mesh?
Well a squeezed ball isn't a ball smile both Esenthel Engine and PhysX don't support squeezed balls.
a Capsule would be more like it.
04-18-2009 06:18 PM
Find all posts by this user Quote this message in a reply
Post Reply