#Adding collision to objects

1 messages · Page 1 of 1 (latest)

topaz zealot
#

I'm just trying to add collision to my pad (yes, it's pong, I'm too dumb to create other stuff).
But when I do, it warns me with that message in the image.
Is there a way to add that collision shape or an easy-ish way to add collision to an object?

frozen tangle
# topaz zealot I'm just trying to add collision to my pad (yes, it's pong, I'm too dumb to crea...

Hi. The collision shape 2D only serves as a shape for a SataticBody, RigidBody or CharacterBody.
What you want is to use either charecterBody or StaticBody node for collision and the collision shape you created as a child of that node. See the documentation: https://docs.godotengine.org/en/4.3/tutorials/physics/physics_introduction.html

topaz zealot
#

I just want basic collisions, that also introduces gravity and stuff I'm def not using

frozen tangle
#

For your application, the characterbody is moody suitable

#

You can remove the code for gravity by editing the script

topaz zealot
#

I've tried that before, I couldn't change the position stuff

#

That's why I'm using a node2d

frozen tangle
#

Node 2d doesn't handle collisions

topaz zealot
#

... what

frozen tangle
#

Node 2d is the basic node for all things 2d, it doesn't implement collisions

topaz zealot
#

why can't I add collisions to it though?

frozen tangle
#

That's just how it is; different nodes have different purposes. If you want to use collisions, you need to use a StaticBody, CharecterBody or RigidBody.

topaz zealot
#

okay, then player would be a characterbody (dunno thename), but then the ball, would have no class (it doesn't make sense with any of these)

frozen tangle
#

You typically use character body for collision objects that are intended to be moved with code.

topaz zealot
#

?

#

it's a ball, not a character

#

not controlled by the player either

frozen tangle
#

O sorry, I meant the animatablebody2D node

#

Since you intend to move it via code

topaz zealot
#

it's not an animation...?

frozen tangle
#

No, its just called that

#

Because animatable meaning can move

topaz zealot
#

I'm remembering why I picked love2d for my old stuff, lol

#

this doesn't make any sense

topaz zealot
#

and there isn't anything on the docs abt how to move it, since the other collsion(whatever)2d seems to have their own way of moving ( no idea why)

frozen tangle
frozen tangle
frozen tangle
#

You need to choose which one best suites your application

topaz zealot