hare krishna Posted August 4, 2016 Share Posted August 4, 2016 Here is the sample souce code using cocos2dx var from = rubber.getPosition(), rubberVec = cc.pSub(to, from), rubberAng = cc.pToAngle(rubberVec), rubberDeg = cc.RADIANS_TO_DEGREES(rubberAng), length = cc.pLength(rubberVec) + (lengthAddon || 8); rubber.setRotation(-rubberDeg); rubber.setScaleX(-(length / rubber.getContentSize() .width)); if (topRubber) { rubber.setScaleY(1.1 - ((0.7 / this.slingRadius.max) * length)); this.slingRubber3.setRotation(-rubberDeg); this.slingRubber3.setPosition(cc.pAdd(from, cc.p((length) * Math.cos(rubberAng), (length) * Math.sin(rubberAng)))); } how to do this in phaser box2d Link to comment Share on other sites More sharing options...
Recommended Posts