#Adding collision to objects
1 messages · Page 1 of 1 (latest)
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
In game development, you often need to know when two objects in the game intersect or come into contact. This is known as collision detection. When a collision is detected, you typically want somet...
I just want basic collisions, that also introduces gravity and stuff I'm def not using
For your application, the characterbody is moody suitable
You can remove the code for gravity by editing the script
I've tried that before, I couldn't change the position stuff
That's why I'm using a node2d
Node 2d doesn't handle collisions
... what
If you want to do anything with collisions, you'll have to use 1 of the nodes mentioned here https://docs.godotengine.org/en/4.3/tutorials/physics/physics_introduction.html
In game development, you often need to know when two objects in the game intersect or come into contact. This is known as collision detection. When a collision is detected, you typically want somet...
Node 2d is the basic node for all things 2d, it doesn't implement collisions
why can't I add collisions to it though?
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.
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)
No, the both the ball and the player would be charecterbody.
You typically use character body for collision objects that are intended to be moved with code.
it's not an animation...?
No, its just called that
Because animatable meaning can move
“A 2D physics body that can't be moved by external forces. When moved manually, it affects other bodies in its path.”
https://docs.godotengine.org/en/stable/classes/class_animatablebody2d.html
Inherits: StaticBody2D< PhysicsBody2D< CollisionObject2D< Node2D< CanvasItem< Node< Object A 2D physics body that can't be moved by external forces. When moved manually, it affects other bodies in ...
I'm remembering why I picked love2d for my old stuff, lol
this doesn't make any sense
" 2D physics body that can't be moved by external forces." so I can't change it via code?
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)
By manually, it means by code.
You move it by adding it position property of the node
Yeah, different ones have their own way of moving: Rigid body is moved by setting forces and impulses, character2d is moved by setting velocity and animatable is moved by changing position
You need to choose which one best suites your application
this kinda looks like a mess, ngl