libgdx+box2d joints not working properly under gravity -
i trying create pendulum using box2d/libgdx connecting static , dynamic body. have tried various types of joints distance joint, rope joint , revolute joint under gravity dynamic body ends escaping down after being constrained joint. in 0 gravity joints work properly. know must doing silly.
world.getbodies(p); distancejointdef djd=new distancejointdef(); djd.bodya=p.get(0); djd.bodyb=p.get(1); djd.localanchora.set(0,0); djd.localanchorb.set(0,0); djd.collideconnected=true; distancejoint pend=(distancejoint)world.createjoint(djd); pend.setlength(50);
ps. have yet implemented contact listener .i have not figured out how this. putting collision listener help?
if question correctly, moving body falls irrespective of type of joint applied. 1 reason why happen because may have defined both anchor , pendulum dynamic bodies, , both fall same way due gravity.
i assuming not yet rendering anchor body, not see falling.
Comments
Post a Comment