Tuesday, October 11, 2022
HomeGame DevelopmentFast paced dynamic physique passes via collider of static our bodies -...

Fast paced dynamic physique passes via collider of static our bodies – Cocos Creator


Hey 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 could be dragged by a mouse.
When dragging the dynamic physique via the mouse at regular velocity, it collides with different static our bodies which stop its motion which is what I anticipate to occur. However, If I drag too quick it might surpass the collider of the static physique as if no collision occurred. Is there any approach to stop this?

Thanks upfront.


There is no such thing as a approach to deal with any velocity
Simply restrict your dynamic objects’ velocity or improve the physics-frame-rate (change system settings – not beneficial) to catch the collision

Because it’s the mouse motion, you may attempt to create a “mouse-joint” to see if the draggable objects velocity is proscribed

Are you able to share demo to test?
Additionally did you strive enabling Bullet?

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

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

Thanks.

That’s bizarre!
If it’s true then you may emulate mouse joint by simulating the pull-force in replace(dt)
One thing 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 might be altering place by way of setPosition which isn’t the right manner if you’re utilizing Physics.
both you take away physics and test collision manually or use impulse to vary place.

Thanks for the reply, Are you able to please inform me what are the methods of manually checking collisions.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments