Overlaping collision shaps

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Fariskurd
:warning: Old Version Published before Godot 3 was released.

Hi guys recently i am facing a weird problem , i made a game for android it consist of a ball and a wall , when i play on pc it works quiet normall ,but when i play on android when the ball hits the wall they stack(overlap) together and entire game stops , any suggestion?

note: this is happens sometime

You will have to be more specific on what type of nodes are your objects, how do you manage collisions, what “entire game stops” means and every detail you can give.

eons | 2016-10-31 20:18

For Ball i used rigidbody2D and it has a circle shap , for wall i used kinemanticbody2D and has rectangle shap ,for collision i used collisionPolygon ,each of ball and wall moves, i also notice that when the wall hit the ball in a way fast they overlap , and yesterday i notice that it also happens on PC , even i tried to change the collision type but didnt worked , also i made a score for when the Ball hits the wall it increase by one ,it does not have any problem with surface of the wall but when the Ball hits one of side of wall the score counts more than one this means (multi hit) occur …

Fariskurd | 2016-11-01 15:22

Are you using _fixed_process(delta)?
If not, try using that instead of _process(delta).

Tybobobo | 2016-11-01 17:02

of course i use _fixed_process(delta) , i think multiple hit issue is a bug with engine they will fix it in v3 but for now i dont have any idea how to fix it …

Fariskurd | 2016-11-01 17:13

Rigidbodies are meant to be moved by impulses/forces, are you doing that or using set_pos?

Also, if the rigidbody moves too fast, it need to use continuous cd.

eons | 2016-11-02 17:41

i made the ball as bounce and i am using set_linear_velocity below is the function that i use when it hit the wall it call the function and pass it a specific speed ,and the wall moves in a circle way by user used _input process ,i also used continuous cd still have same issue .

func move_ball(speed):
var lv=get_linear_velocity().normalized()*speed
set_linear_velocity(lv)

Fariskurd | 2016-11-02 18:27

The kinematic wall movement could be the problem if you move it outside _fixed.

Using _input you can set movement values on variables but the proper movement (move or set_pos) needs to be done on _fixed_process

eons | 2016-11-03 04:27