I am developing a game and engine. It is crashing with a very annoying error message when the accident occurs when the body changes to change the situation. I am using the body.setTransform
method to change the position. My code is following.
public view onCreateScene () {this.mScene = new scene (); This.mscene.setBackground (new background (0, 0, 0)); This.mScene.setOnSceneTouchListener (this); This.mScene.setOnAreaTouchListener (this); This.mphysicsWorld = new physical world (new vector 2 (0, 10), wrong); // Some code facebox = new sprite (bx, camera_height-amplitudexytegatehit () - 25, this.mplayer typewriter rage, this.gettextaxbufferObjectManager ()); Body = PhysicsFactory.createCircleBody (mPhysicsWorld, facebox.getRotationCenterX), facebox.getRotationCenterY (), facebox.getWidthScaled () * 0.6f, bodytip. Dynamic body, fixturesideedad); // (this.MfijixWorldWorld, Facebox, BodyType, Dynamic Body, FIXTREDADF); Body.setFixedRotation (true); Body.setUserData ("player"); This.mScene.attachChild (faceBox); This.mphysicsWorld.registerPhysicsConnector (new physical connector (facebox, body, true, true)); // some code it MEngine.registerUpdateHandler (New FPSLogger () {@Override public void onUpdate {float psecondoppleps} {try {if (ball.getPosition () .x & lt; = n.getPosition () .x & amp; amp; ball.getPosition ) Y & lt; body.getPosition (.) Y-1.3f & difficulty) {body.setTransform (ball.getPosition () .x-0.6f <(l.getPosition (.) X + 2 * ( L.getPosition () .xl.getWorldCenter () x) + 0.83f (l.getPosition () x + 2 * (l.getPosition (.) Xl.getWorldCenter () x) + 0.83f). Ball.getPosition () .x-0.6f, body.getPosition (). Y, body.getAngle ());}} hold (exception e) {e.printStackTrace ();} // some code.}); } Return it Mccen; }
Error logs from logcat.
03-03 13: 02: 16.374: A / Libsea (5892): / user / nagramlitch / workspace / gdk / graphic_engines / AndEngine / AndEnginePhysicsBox2DExtension / jni / Box2D / Dynamics / b2Body .cpp: 395: Zero b2Body :: SetTransform (constant b2Vec2 & amp; float32): assert "m_world-> IsLocked () == false" 03- Has failed 03 13: 02: 16.375: A / libc ( 5892): Fatal Signals 11 (SIGSEGV) 0xdeadbaad (code = 1), thread 5936 (thread-474)
It crashes when your physicalworld
is locked You should see if it's locked or not isLocked
with your method Code should be used
if body.setTransform (ball.getPosition () x-06.6 f. & Lt (mPhysicsWorld.isLocked ()!); .. (L.getPosition ( ) X + 2 * (l.getPosition () .xl.getWorldCenter (.x) + 0.83f)? (L.getPosition () .x + 2 * (l.getPosition (.xl.getWorldCenter) .x ) 0.83 f): .. ball.getPosition () x-0.6f, body.getPosition () y, body.getAngle ());
No comments:
Post a Comment