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

Collision between triangles sometimes not detected #373

Open
mqnc opened this issue Dec 3, 2024 · 0 comments
Open

Collision between triangles sometimes not detected #373

mqnc opened this issue Dec 3, 2024 · 0 comments

Comments

@mqnc
Copy link

mqnc commented Dec 3, 2024

<!DOCTYPE html>
<html>

<head>
	<title>p2 misses collision between triangles</title>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/p2.js/0.7.1/p2.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/p2.js/0.7.1/p2.renderer.min.js"></script>
</head>

<body style="margin: 0; overflow: hidden;">
	<script>

		var app = new p2.WebGLRenderer(function () {

			var world = new p2.World({ gravity: [0, 0] })
			this.setWorld(world)

			function triangle(a, b, c) {
				var shape = new p2.Convex({ vertices: [a, b, c] });
				var body = new p2.Body({ mass: 1 });
				body.addShape(shape)
				world.addBody(body)
				return body
			}

			triangle([0, 2], [-1, 0], [1, 0])
			triangle([-1.5, 1.5], [-2, 1], [-1, 1]).velocity = [0.3, 0]
		});

	</script>
</body>

</html>
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

1 participant