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

(Testbed) Box position offset when not using piqnt editor #295

Closed
armput opened this issue Nov 12, 2024 · 2 comments
Closed

(Testbed) Box position offset when not using piqnt editor #295

armput opened this issue Nov 12, 2024 · 2 comments

Comments

@armput
Copy link

armput commented Nov 12, 2024

I'm learning planck and I'm using the AIJS Editor and whenever I run the testbed, it offsets boxes by about (-0.3, 0.3).
image
The dot and the body are both at (0, 0) but you can see that the box is offset a tiny bit.

Here's the code:

const { World, Testbed, Box, Vec2 } = planck;
planck.testbed(function(testbed) {
    const world = new World();

    let box = world.createDynamicBody(Vec2(0, 0));
    box.createFixture(Box(2, 8), 2);
    
    console.log(box.getPosition());

    testbed.step = function() {
        let pos = box.getPosition();
        testbed.drawCircle({x: pos.x, y: pos.y}, 0, '#fff');
    }

    return world;
});

I went over to the piqnt.com editor and it works as expected but in the other editors I've tried boxes are offset.

Is there any way to fix this issue more permanently than offsetting the position?

[Update]: So apparently this also applies to polygons.

@armput armput changed the title (Testbed) Body position offset when not using piqnt editor (Testbed) Box position offset when not using piqnt editor Nov 12, 2024
@shakiba
Copy link
Collaborator

shakiba commented Nov 12, 2024

Thanks for reporting!

I'm rewriting the testbed, I will fix this one as well.

Currently the testbed in this repo is slightly different from the implementation in piqnt.com, after rewrite they will share the same code.

@shakiba
Copy link
Collaborator

shakiba commented Dec 27, 2024

I fixed this in v1.3.0.

@shakiba shakiba closed this as completed Dec 31, 2024
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