#Any idea on what is happening? (Objects are teleported after collision)
54 messages · Page 1 of 1 (latest)
is something supposed to happen when they collide?
may we see your code for the objects?
does godot have a "on-collision" signal?
i tried to find one but failed
I have no idea how to do something when they collide
btw, I'm trying to reproduce this with a minimal scene
what type of node are the objects?
yellow: rigidbody2d
white: staticbody2d
the small rigidbody2d's shape is a irregular shape generated by code
(player draws shapes on screen and my code generated collider based on it)
the large one is a rectangle
if something went wrong, it might be my generation code generated a weird shape that usually shouldn't exist
RigidBody has the body_entered signal
Inherits: PhysicsBody2D< CollisionObject2D< Node2D< CanvasItem< Node< Object Inherited By: PhysicalBone2D A 2D physics body that is moved by a physics simulation. Description: RigidBody2D implement...
you can check all the signals and methods here
I googled about that before and everything I saw was about interaction between area2d and rigidbody2d. (Now I know, the actual reason is physics simulation game is rare)
you can always press F1 in engine and search the documentation of anything
Nodes even have that little DOC button on the corner
or right-clicking in the code you can Lookup Symbol
nothing is printed when a collision happens
did i connect the correct signal?
this is the entire test scene
i turned on contact moniter and it doens't make a change
sorry, i didn't set maxcontacts to a larger value
(but it still doesn't solve the gif's problem, at least i'm able to debug now)
this one shows what happened: the large object crushes small object into ground, then something weird happens
You should try the box2d plugin
Godot physics isn't great, box2d is more established and better maintained atm
The game was about to be released and playertesters suddenly found these bugs
you saved my life! (edit: not really, it is still happenning)
should i replace my "generate a polygon outline of player drawn line" code with "generate a series of capsules and attach all of them to the line's collider"?
There are also some project settings in the physics 2d section that might help with this. But that's not something I have experience with.
What I would try is going back to godot physics, maybe increase the ticks to 240 and see if that helps and if not try some different solver, margin or penetration settings.
It's worth a try too
You could also open an issue on the box2d plugin github page and see if the dev there has any ideas.
Box2d should definitely be able to handle this imo, and the dev is usually very helpful and quick to respond
does godot-box2d support colliders with holes and self intersecting colliders?
(godot physics doesn't support these, and my game is about hand drawn colliders, I can't say "player, you cant draw a ring")
i just installed it, it seems godot box2d only supports godot's collider shapes?
it only provides box2d equivalents for existing godot nodes/shapes
but usually its more stable
using your series-of-capsules-approach it should be possible to make a ring. otherwise you might have to generate a polygon hull from those ring edge points so you get a solid shape
series of capsules work for me
my solution for self-intersecting shape was: cut a 0 width slice from the ring, so that game engine no longer thinks it has a hole
still a bit weird, at least players won't complain for this
(i replaced my outline function with series of collision shapes, and godot physcis with box2d)
thank you for the help
I'm glad it works now !! 🥳