An odd, cryptic error from libgdx's version of box2d involving a mousejoint

对着背影说爱祢 提交于 2019-12-11 21:15:06

问题


Code

There is my code for my Screen object. The garble of arrays and Vector2s at the bottom is just a long list of models for the cats. My goal is to make a port of http://catsinspace.co.nf, my website, to learn how to use libgdx and its box2d port. I am trying to get the mousejoint working, but I apparently don't understand how a groundBody is supposed to work, despite my hours of googling. Here is my strange, cryptic error that I have tried googling fruitlessly:

AL lib: alc_cleanup: 1 device not closed
Assertion failed!

Program: C:\Program Files\Java\jre7\bin\javaw.exe
File: /var/lib/jenkins/workspace/libgdx/gdx/jni/Box2D/Dynamics/Joints/b2MouseJoint.cpp, Line 125

Expression: d + h * k > 1.19209289550781250000e-7F

It pops up when I try to drag the cat, but I can try to drag the walls without error.

I figured it out. I'm an idiot. The actual body that you want to be dragged needs to be bodyB and not bodyA.


回答1:


def.bodyA = groundBody;
def.bodyB = callback.body;
def.maxForce = 1000f;

This will make it work, though I cannot explain you why...



来源:https://stackoverflow.com/questions/19735460/an-odd-cryptic-error-from-libgdxs-version-of-box2d-involving-a-mousejoint

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!