How to create Convex Hull shapes

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

How to create Convex Hull shapes

Postby TreantBG » Wed Apr 25, 2012 5:18 pm

Hello
i make a game with delphi and the old Newton engine i think 1.3.
The game is 2D. I use the not so good Andorra 2d engine and i made changes to it.
And i want my pictures to have their own shape not just box and my character to collide with empty space (transparent pixels).

So tell me how to create a Convex Hull shape for example a triangle (the Z component is 100 always)
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: How to create Convex Hull shapes

Postby Julio Jerez » Thu Apr 26, 2012 7:27 am

you just pass teh vetice array, to teh cratecollsion funtions.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: How to create Convex Hull shapes

Postby TreantBG » Thu Apr 26, 2012 11:43 am

i know that but my question is how to build the vetice array.
i dont have it ready i have to create it corresponding to the picture.

Can someone to tell me how to build veticle array for a triangle shape Convex Hull?
For example like this Image
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: How to create Convex Hull shapes

Postby Julio Jerez » Thu Apr 26, 2012 12:26 pm

you take the three point o fthe triangle, and you place then in and array tha has room for 6 point
you copy the thre point i teh first three point o fteh array and you copy teh again in teh last three points.
the add the z dipslacent to teh z compounent of te hfirs three points o fteh array.

teh you cal create conve hull with and array of 6 points,
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: How to create Convex Hull shapes

Postby TreantBG » Thu Apr 26, 2012 2:09 pm

can i get some example code????
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: How to create Convex Hull shapes

Postby carli2 » Fri Apr 27, 2012 4:38 pm

If you want pascal code, you can look into the Code of gwX

http://goldenwipf.de/hg/index.cgi/file/ ... sition.pas

For this class, you add the triangles and get out a NewtonCollision.

This algorithm is O(n²), but if you optimize, please contribute it back.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: How to create Convex Hull shapes

Postby TreantBG » Sun Apr 29, 2012 2:58 am

Ok i did it with my code.
And i created a function that converts a image to points.
But the problem is this:

this is the points of the image that i get
Image

but when i execute the program this is the real object shape:
Image

How can i make the shape that i want?
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: How to create Convex Hull shapes

Postby Julio Jerez » Sun Apr 29, 2012 7:21 am

for that you can use NewtonMeshApproximateConvexDecomposition()
but it si a new funtionality of core 300.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: How to create Convex Hull shapes

Postby TreantBG » Sun Apr 29, 2012 1:07 pm

is there another way?
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: How to create Convex Hull shapes

Postby Julio Jerez » Sun Apr 29, 2012 1:37 pm

you can make it a collision tree if it is static.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron