来自libgdx版本的box2d的一个奇怪的,隐秘的错误,涉及一个鼠标关节 [英] An odd, cryptic error from libgdx's version of box2d involving a mousejoint

查看:97
本文介绍了来自libgdx版本的box2d的一个奇怪的,隐秘的错误,涉及一个鼠标关节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码

我的Screen对象有我的代码.底部的数组和Vector2乱码只是猫的一长串模型.我的目标是建立我的网站 http://catsinspace.co.nf 的端口,以了解如何使用libgdx及其box2d端口.我正在尝试使mousejoint正常工作,但是尽管我花了很多时间进行搜索,但我显然不明白groundBody应该如何工作.这是我尝试毫无结果地尝试使用的奇怪的,隐秘的错误:

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.

我知道了.我是个白痴.您要拖动的实际主体需要为bodyB而不是bodyA.

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

推荐答案

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

这将使其起作用,尽管我无法向您解释原因...

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

这篇关于来自libgdx版本的box2d的一个奇怪的,隐秘的错误,涉及一个鼠标关节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆