Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

physicsDevice.createConvexHullShape creates incorrect hull shape #38

Open
davidfooks opened this issue Jun 22, 2014 · 1 comment
Open

Comments

@davidfooks
Copy link
Contributor

Create a convex hull with the following points

        var myPoints = [
            -1, -1, -2,
             1, -1, -2,
            -1,  1, -2,
             1,  1, -2,
            -1, -1,  1,
             1, -1,  1,
            -1,  1,  1,
             1,  1,  1,
             0,  0,  2
        ];

        shape = physicsDevice.createConvexHullShape({
                points    : myPoints,
                margin    : 0.005
            });

Note that the resulting convex hull consists of only one triangle (in the simulation and rendering).

You can test this by replacing these points in the physics_collisionmesh sample:
https://github.com/turbulenz/turbulenz_engine/blob/master/samples/tsscripts/templates/physics_collisionmesh.ts#L661

However, if I move the points by some small random number

        var i;
        for (i = 0; i < myPoints.length; i += 1)
        {
            myPoints[i] += Math.random() * 0.01;
        }

The convex hull renders and behaves as expected.

If there are some expected properties of the points array can you please document them here:
http://docs.turbulenz.com/jslibrary_api/physicsdevice_api.html#createconvexhullshape

@ianballantyne
Copy link

Thank you for identifying this issue, we will look into and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants