Closed ken-sands closed 8 years ago
Sounds like you're trying to move static bodies, which is not recommended. You can set them to kinematic upon creation instead, to be able to move them.
Oh sorry no I'm not trying to move them, this issue occurs when they are created in that position. my moving it example was just an easy way show the effect. Set the position in the plane constructor and it still acts as I describe.
if you look at the ragdoll html you'll see the plane is created at 0,-1, change the html to
var plane = new p2.Body({ position:[0,0.3], });
and see the issue.
You can create a plane with a y of 0 or any minus amount you like and it acts as expected, but create it above 0 at all and things go funny.
Am I explaining this any better or am I seeing it all wrong?
Oh, then it's a bug... Will have to debug this. You're using the latest version? Did you run the build on master branch?
Yes, latest version from the master branch. Latest build that is. so the 0.71 version.
by the way it works fine if it's a box rather than a plane, ie if I use a 0 mass box as my floor I can create it anywhere and it acts as expected just the plane that seems to have the issue.
Looks like I cannot reproduce this any more. I tried modifying ragdoll.html so that the plane has initial position [0, 0.3]. I think it was resolved.
I just tested on https://schteppe.github.io/p2.js/demos/ragdoll.html It's still broken, is that still pointing at an old version of the library?
I'm on chrome on windows, opened that page then in the f12 console i passed world.bodies[11].position[1] = 0.3; to set the ground plane, and it's bouncing all over.
Yea, the live demos are using an old version. Didn't release yet. Try checking out the project locally, running npm install && grunt
and opening demos/ragdoll.html
.
I think the problem was that the AABBs didn't update properly. Try pressing the T key and the bounding boxes will get rendered. In the old version you can see that the top edge for the plane is always 0 (due to a bug) but in the master version it matches the plane.
Ahhh, yep, seeing that. Cool I'll grab the new version and close this. Thanks.
The bug still occurs and I just installed it from npm. Do you know when it will be released ?
When positioning a 0 mass plane, (ie the the ground) if it is set to a y position above 0 then objects hitting it are bounced up with the force of that y position.
To see this, load the ragdoll demo and move the ground up.
do this in the console...
world.getBodyById(13).position[1]=0.1;
or if you want it to dance more!
world.getBodyById(13).position[1]=0.5;
for any y position below 0 it seems fine.