android - Revolute joint in libgdx is not rotating back(not working) when limit reaches.How to control revolute joint based on user touch -


i have been searching how control revolute joint in libgdx box2d based on user touch , revolute joint being stopped after reached upper angle.is there way control revolute joint ?

   `      jd = new revolutejointdef();      jd.initialize(bodypivot, boxbody, anchor);      jd.lowerangle = 0.75f * (float)3.14; // -90 degrees     jd.upperangle = 0.75f * (float)3.14; // 45 degrees     jd.collideconnected=false;     jd.enablelimit = true;     jd.maxmotortorque = 1000.0f;     jd.enablemotor=false;     jd.motorspeed = 0f*(float)3.14;     rj = (revolutejoint) world.createjoint(jd);` 

i tried using rj.enablemotor(true) didn't work

when create joint current relative angle between bodies taken 0 when comes specifying limits.

if joint keeps rotating in same direction time limits don't change, because new starting point 0 far limits concerned.

jointdef.upperangle = mathutils.pi; jointdef.lowerangle = 0;//the position when joint created 

but if joint supposed rotate original position before coming down, like:

jointdef.upperangle = attop ? 0 : mathutils.pi; jointdef.lowerangle = attop ? -mathutils.pi : 0; 

i found answer here


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -