piqnt / planck.js

2D JavaScript Physics Engine
http://piqnt.com/planck.js/
MIT License
4.87k stars 236 forks source link

how to use mouseJoint without the testbed #178

Open bobcgausa opened 3 years ago

bobcgausa commented 3 years ago

I'm writing a p5 interface for planck and i don't use the testbed because i want p5 graphics. however i can't create a mouse joint in mousePressed

so i created a mousejoint statically

now what can i do in mousePressed to set the target body and location? any help appreciated

here's the example https://editor.p5js.org/Bobcook47/sketches/OlzHvRszI

i only want to drag the figure that i click

I already did a P5 box2d interface with a much more extensive tutorial than any that I found for planck https://github.com/bobcgausa/cook-js I plan to rewrite the tutorial for planck once i finish but i need HELP with modifying a mouse joint dynamically

bobcgausa commented 3 years ago

here's the p5 example https://editor.p5js.org/Bobcook47/sketches/OlzHvRszI

shakiba commented 3 years ago

Have you checked out testbed code? It is in testbed folder.

bobcgausa commented 3 years ago

Yes I looked at testbed codeI have to create mousejoint in setupThen in mousepressed I get body and need to reset body a and b.As code shows, it didn't workTestbed doesn't work that wayOn Apr 21, 2021 2:34 AM, Ali Shakiba @.***> wrote: Have you checked out testbed code? It is in testbed folder.

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.