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 cell supporting recreation. There are a number of static our bodies (with Box2Dcollider) within the scene and one dynamic physique (With Box2Dcollider) which might be dragged by a mouse.
When dragging the dynamic physique by means of the mouse at regular pace, it collides with different static our bodies which stop its motion which is what I anticipate to occur. But, If I drag too quick it might probably surpass the collider of the static physique as if no collision occurred. Is there any technique to stop this?

Thank you upfront.

There is not any technique to deal with any pace
Just restrict your dynamic objects’ pace or enhance the physics-frame-rate (change system settings – not advisable) 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 pace is proscribed

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

Hi, @gadapchetvoi Thanks for the reply. I can restrict the pace utilizing a mouse-joint and keep away from the problem. Like I stated 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 );

I checked the demo.
You are altering place through setPosition which isn’t the right approach if you’re utilizing Physics.
both you take away physics and verify collision manually or use impulse to vary place.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here