Piercing collision object when gameobject move with fast speed!

I have a gameobject and wall. Wall is static collision object and gameobject is dynamic collision object. Wall alway block that gameobject if it move with slow or normal speed. But, If gameobject move with fast speed. It can move over and percing wall. How way to solve problem(no code, only setting or code)? I moving gameobject by go.set_position(gameobject position + direction * speed)

Tunnelling is always a problem with games, you could try selecting Bullet in the options when dealing with the collision object that’s moving. Also look into trying to use forces applied to the object with physics rather than setting the objects location with go.set_position.

You shouldn’t be doing that with a dynamic collision object. Dynamic means the physics engine handles the forces and movement for you, so moving it yourself could cause issues. Consider using a kinematic collision object instead.

2 Likes

Continuous collision detection (CCD) . ‘Fast moving objects in Box2D can be labeled as bullets. Bullets will perform CCD with both static and dynamic bodies.’ (from box2d docs: Box2D: Dynamics Module)
I don’t know how this is actually implemented in Defold, it would be good to know.

This is good to watch: https://www.youtube.com/watch?v=sKHf_o_UCzI

1 Like

yes bro, CCD is true result i want to know. i don’t see some setting of collision meaning like CCD. To solve this problem, i using a code method to detect when gameobject collision with wall and stop it. But, this method so hard to use for many gameobject

As I stated in my previous post, the setting for this is ‘bullet’. The video I linked is by the author of Box2D; a thing this illustrates is that physics engines often do not ‘just work’, they tend to be hard to use.

2 Likes

This setting never worked for me when you’re moving the go. You can’t do what he’s trying to do with go.set.

I never found a great way to handle it myself.

1 Like

yes. i was try using bullet setting for collision. But, not working. May be, if i want to solve problem, i think must use code checking method to claim position.

I founded a secret may be can help any one. If i move gameobject by go.set_position(gameobject position + direction * speed). If i fix gameobject speed equal 1 or lower, CCD(Bullet check) of collision object is really working. If you have a big number of direction or normal number of direction, it really working. I founded that problem when i thinking for power push to gameobject move and change from speed = 2 to speed = 1. So if you want to create a gameobject moving like dashing you need set speed from 1 or lower. Or if you want speed is highter number than 1, you need speed * const(deltatime number)

You have to use ‘force’ if you want a stable solution on physics world. Your solution without a dt calculation is not appropriate and may acquire different speed on different hardware/refresh rate.
Also using raycast is an other proper solution for tunneling.

6 Likes