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

setting pivots in useConstrained on setup isn't enough #51

Open
drcmda opened this issue Mar 28, 2020 · 5 comments
Open

setting pivots in useConstrained on setup isn't enough #51

drcmda opened this issue Mar 28, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@drcmda
Copy link
Member

drcmda commented Mar 28, 2020

im trying to do this: http://schteppe.github.io/cannon.js/examples/threejs_mousepick.html

in the example repo, the monday morning demo, try picking the chair - it just makes no sense because it goes to object center (i guess). the pivot needs to be calculated once the object is clicked. but currently the constraint is first set up with a fixed pivot, then disabled and enabled on demand.

any ideas how this could be solved?

@codynova
Copy link
Member

It looks like in Schteppe's demo, he's just creating a new constraint on each click. I can't think of any reason why we couldn't allow updating a constraint's pivots (which doesn't mean there isn't a reason, haha), just need to make that possible in cannon-es.

@drcmda
Copy link
Member Author

drcmda commented Mar 28, 2020

i believe its really just a loose vector on the object, so it could be overwritten, correct? in that case we could maybe extend makeApi with new updaters.

@codynova
Copy link
Member

I just checked and it looks like you're right, should be fine to just overwrite those vectors, and they should get updated automatically (rotated into World space) on the World step

@codynova codynova added the enhancement New feature or request label Mar 28, 2020
@codynova
Copy link
Member

codynova commented Apr 1, 2020

I took a quick stab at it, but I'm not sure if the pivot vectors are in the correct coordinate space. Can you test this branch against the MondayMorning demo when you have a moment?

It's worth noting that some constraints don't have pivots, and some constraints do have axes - so I think we should make the types more honest at some point...

Is there a reason to add the axes to the Constraint API (I'm guessing yes)?

@mattrossman
Copy link

Is there any progress on this issue? I'm trying to make a demo much like the mousepick one that Paul shared, and I'm stuck because reactive pivots in usePointToPointConstraint don't work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants