2

I have been banging my head against a brick wall for the past few hours.
I can't for the life of me get a mousejoint to work in the libgdx framework or java.
Could someone provide me with a quick example with sourcecode on how to use a mousejoint with libgdx? If not, with just Java? Thanks

dewijones92
  • 1,319
  • 2
  • 24
  • 45
  • The jbox2d testbed example may be useful (look for the mouseDown function) http://code.google.com/p/jbox2d/source/browse/trunk/jbox2d-testbed/src/main/java/org/jbox2d/testbed/framework/TestbedTest.java – iforce2d Aug 29 '12 at 02:55

1 Answers1

3

You can download the whole libgdx trunk and take a look at the tests. For instance, check this one out:

https://github.com/libgdx/../tests/Box2DTest.java

It uses a mouse joint to pick and drag a body.

Reloecc
  • 256
  • 2
  • 13
aacotroneo
  • 2,170
  • 16
  • 22
  • +1 and I have one question: Does MouseJoint support 2 fingers? If yes, share a link, please. – Nolesh Jul 02 '13 at 14:34
  • I dont have an example... but I guess you'll just have to associate one joint to each finger (pointer). That should be easy... – aacotroneo Jul 02 '13 at 21:23
  • Make a list of Joints, for each finger down add a new joint associated with one finger to the list, for each finger up delete the associated joint from the list. – Gustavo Maciel Oct 16 '13 at 01:47