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

Trapezoid with slope=1 did not collide with other objects #138

Closed
YChebotaev opened this issue Aug 20, 2015 · 4 comments
Closed

Trapezoid with slope=1 did not collide with other objects #138

YChebotaev opened this issue Aug 20, 2015 · 4 comments
Labels

Comments

@YChebotaev
Copy link

// Matter.js module aliases
var Engine = Matter.Engine,
    World = Matter.World,
    Bodies = Matter.Bodies;

// create a Matter.js engine
var engine = Engine.create(document.body);

// create two boxes and a ground
var trap = Bodies.trapezoid(400, 10, 80, 80, 1)
var boxA = Bodies.rectangle(400, 200, 80, 80);
var boxB = Bodies.rectangle(450, 50, 80, 80);
var ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true });

// add all of the bodies to the world
World.add(engine.world, [boxA, boxB, ground, trap]);

// run the engine
Engine.run(engine);

http://codepen.io/anon/pen/GJbZyv

@liabru
Copy link
Owner

liabru commented Aug 21, 2015

Do you need a triangle? Use Bodies.polygon with sides 3.

Otherwise, I can't see why you'd want a trapezoid with slope 1 because it doesn't generate a trapezoid. The value should be more like 0.1 to 0.5, so closing this, thanks.

@liabru liabru closed this as completed Aug 21, 2015
@YChebotaev
Copy link
Author

It's a bug and it must be fixed.

@liabru
Copy link
Owner

liabru commented Aug 21, 2015

It's a rare edge case, can you tell me why you need this and I will reconsider?
Otherwise, feel free to submit a pull request.

@liabru liabru reopened this Aug 21, 2015
@YChebotaev
Copy link
Author

I don't actually need this but i was trying to get a triangle with one side shorter and slope=1 gives me figure i was looking for. This is how i find this bug.

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

No branches or pull requests

2 participants