0 votes

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

in Engine by (57 points)
edited by

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.

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 ...

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

of course i use fixedprocess(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 ..

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.

i made the ball as bounce and i am using setlinearvelocity 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 moveball(speed):
var lv=get
linearvelocity().normalized()*speed
set
linear_velocity(lv)

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.