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

Shape position changed when added to a body #356

Open
dooxe opened this issue Apr 17, 2020 · 0 comments
Open

Shape position changed when added to a body #356

dooxe opened this issue Apr 17, 2020 · 0 comments

Comments

@dooxe
Copy link

dooxe commented Apr 17, 2020

Hello,

I have a problem positionning a shape in a body.
My code is pretty simple:

var body = new p2.Body({
	mass: 0
});
var box = new p2.Box({
	position: [50, 50],
	width: 50,
	height: 50
});
console.log(box.position);
body.addShape(box);
console.log(body.shapes[0].position);

(avalable in this codepen: https://codepen.io/dooxe-the-reactor/pen/WNQwVQE )

The first console.log display well the position of the shape: [50, 50],
But the second log display [0 , 0].

Is that an intended behavior ? If so could you explain me how to position shape in a body ?

Thanks a lot

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