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

getVelocityAtWorldPoint() requires result parameter, despite returning result #175

Open
gnbl opened this issue Feb 26, 2023 · 1 comment

Comments

@gnbl
Copy link

gnbl commented Feb 26, 2023

getVelocityAtWorldPoint requires result as parameter, despite returning result.

// unexpected
let v = body.getVelocityAtWorldPoint( point );
>> Uncaught TypeError: vector is undefined

// workaround
let v = new CANNON.Vec3();
body.getVelocityAtWorldPoint(point, v);

It would be more consistent with the rest of the methods if the result parameter were optional.

@gnbl
Copy link
Author

gnbl commented Feb 26, 2023

Passing a dummy Vec3 is easier to read:

let v = body.getVelocityAtWorldPoint(point, new CANNON.Vec3());

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