i have an object falling and in the bottom an object moving. i want that the object falling when it collides it sticks to the moving object.
https://snag.gy/SAlNga.jpg
the result is that falling object bounces.never sticks. It keeps moving and then falls.
i tried setting the sphere rigidbody from dynamic to kinematic so can attach using set parent, but Box2d crashes.
onPostResolve (contact, selfCollider, otherCollider)
{console.log(otherCollider); if(otherCollider.node.name=="Player" && ! this.bIsSticked && this.bCanStick) { this.bIsSticked=true; this.bCanStick=true; // otherCollider.getComponent("PlayerController").addSnowBall(this.node); this.rb.linearVelocity=new cc.Vec2(0,0); let joint= this.node.getComponent(cc.WeldJoint); let arrowBody = selfCollider.body; let targetBody = otherCollider.body; let worldCoordsAnchorPoint = arrowBody.getWorldPoint( cc.v2(0.6, 0) ); joint.connectedBody = targetBody; joint.anchor = arrowBody.getLocalPoint( worldCoordsAnchorPoint ); joint.connectedAnchor = targetBody.getLocalPoint( worldCoordsAnchorPoint ); joint.referenceAngle = targetBody.node.rotation - arrowBody.node.rotation; joint.enabled = true; joint.apply(); } }