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

body.addShape VS body({ shape: ... }) #495

Open
eric-t-a opened this issue Apr 11, 2024 · 0 comments
Open

body.addShape VS body({ shape: ... }) #495

eric-t-a opened this issue Apr 11, 2024 · 0 comments

Comments

@eric-t-a
Copy link

I have a RaycastVehicle positioned at the origin. Then I tried to create a floor.
If I do it like this it works fine:

const groundBody = new CANNON.Body();
groundBody.addShape(new CANNON.Plane());

groundBody.quaternion.setFromAxisAngle(
    new CANNON.Vec3(-1, 0, 0),
    Math.PI * 0.5
);

but if I do it like the below, seems like the floor does not get rotated and my car get's stuck at the origin cause there seem to be a wall that did not get rotated to be the floor.

const groundBody = new CANNON.Body({
   shape: new CANNON.Plane()
});

groundBody.quaternion.setFromAxisAngle(
    new CANNON.Vec3(-1, 0, 0),
    Math.PI * 0.5
);

Am I doing something wrong? Docs aren't very descriptive so I don't know why there's two ways to do the same thing (if they do indeed the same thing)

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