0
\$\begingroup\$

I have a hero, I drag him with-mouse joint attached to his rigidBody. But I want to stop dragging him when he hits a trap.

I want the mouse-joint stop working without event "touch-end" being fired. But I've tried to remove even the mouseJoin-Component from the hero node without luck.

Please any one with any suggestion ?

I'm using Cocos Creator with JS Thanks!

\$\endgroup\$
0
\$\begingroup\$

I've tried to trigger a fake event "touch-end" on the node without luck. But a minute later I found the answer (It was pretty simple)

node.active = false;
node.active = true;

When node is inactive, it stop dragging.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.