Home Game Development Fast transferring dynamic physique passes by means of collider of static our bodies – Cocos Creator

Fast transferring dynamic physique passes by means of collider of static our bodies – Cocos Creator

0
Fast transferring dynamic physique passes by means of collider of static our bodies – Cocos Creator

[ad_1]

Hello everybody, I’m attempting to construct a cellular supporting recreation. There are a number of static our bodies (with Box2Dcollider) within the scene and one dynamic physique (With Box2Dcollider) which will be dragged by a mouse.
When dragging the dynamic physique by means of the mouse at regular velocity, it collides with different static our bodies which forestall its motion which is what I count on to occur. But, If I drag too quick it will possibly surpass the collider of the static physique as if no collision occurred. Is there any approach to forestall this?

Thank you upfront.

There isn’t any approach to deal with any velocity
Just restrict your dynamic objects’ velocity or enhance the physics-frame-rate (change system settings – not really helpful) to catch the collision

As it’s the mouse motion, you possibly can attempt to create a “mouse-joint” to see if the draggable objects velocity is restricted

Can you share demo to test?
Also did you attempt enabling Bullet?

Hi, @gadapchetvoi Thanks for the reply. I can restrict the velocity utilizing a mouse-joint and keep away from the problem. Like I mentioned earlier than I’m constructing a web-mobile construct and the mouse-joint doesn’t work on mobiles.

Hello @smitpatel88. I attempted enabling bullet and it didn’t assist.
Here is the demo.
DemoProject.zip (1.6 MB)

Thank you.

That’s bizarre!
If it’s true then you possibly can emulate mouse joint by simulating the pull-force in replace(dt)
Something like:

pullingVector = ....... // calculate from place of mouse & objects
forceIntensity = .... // calculate from mouse distance
obj.rigidBody.applyLinearImpulse( pullingVector.mul(forceIntensity), cc.Vec2.ZERO, true );

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here