Hi,

I'm still new to Godot and I've been through all the tutorials I'm aware off, but some basic information that puts everything in perspective is missing, especially in the confusing docs - at least for a beginner like myself.

I'm not sure if this is a question, or a discussion - so I've posted this in Chat.

I need to understand, and maybe this will help other new users out too, what these specific Nodes below are for - I've listed what uses I think they are for, but please feel free to comment and correct me!

I'm mostly interested in 2D games to get started with Godot, so these are the Nodes that have interested me most and their uses (I realise some may overlap).

Node2D Main Stage to hold all Attached/Instanced 2D Scene/Stage?

KinematicBody2D For Character/Player Sprites e.g. Mario, Frogger, Space Invaders, Galaxians, Defender, Sonic.

RigidBody2D Physics Characters/Player e.g. Pong, Asteroids, Angry Birds, Little Big Planet.

One that appears here and there, but I can't seem to make clear is:

Area2D

Is it for Projectiles/Bullets, lasers, rockets? Or is it something totally different?

I also read it was to do with collisions, but I've seen it used as a Root Node often in place of the others listed above - what's it all about?

I'd love to be enlightened by all this, it's driving me a bit nutty.

Cheers!

Hi, I'm not a confirmed developer but I share my thought since I have some experience with Godot (sorry if my english is not accurate or correct).

Node2D: It's a possible use case but you can use this everytime you want to group several sprites and move them together. Personnaly I use a basic node as a root if I'm sure the root doesn't need to move. You can use every node you want as root. If I have a simple scene with only a sprite, I simply keep the sprite as root (but some people may disagree with me).

KinematicBody2D: I agree.

RigidBody2D: I agree but you can do these games with KinematicBody2D too, without so much coding. KinematicBodies are controlled with accuracy by your script and the behaviour is more predictable since the physic engine is not fully involved (only collision detection). Personnaly I use rigidbodies for balls or everything who are not directly controlled by the player inputs. In the asset library you can find an example of a platformer with KinematicBody and another with RigidBody so you can pick up your choice.

Area2D: Projectiles is a possible use case. Areas defines zones in you game world and simply detect the other bodies if they enters the zone or if they exits. I use "body_enter" or "body_exit" in every Godot project I made. It's not specially intended to be a "root node" or something. Every scene must have a root and you can use every kind of node as a root like I said in the beginning.

Thanks NeoD for you information.

RigidBody2D, is more for Angry Birds, Balls bouncing etc... Things that interact with the scene with physics... e.g. ragdoll - bullet physics on other engines?

I'm still not so sure about Area2D Nodes though, can you give any examples of their specific usage please?

What is meant by detecting "other bodies"... "bodies" being sprites perhaps in a collision? But why? We already have CollisionShape2D etc?? Confused :)

If I wished to shake the screen, I would have to use a specific Root Node for the main scene, not a Node2D?

All interesting stuff!

An area node detects area overlap, so if something is within it's bounds. CollisionShape2D doesn't do that. In effect you want to be sparing with Area2D since logically it should be computationally heavier. But there are situations where a more simple thing such as the CollisionShape2D might just not solve a problem.


In fact the Area2D inherits from the CollisionShape2D so it is essentially a superset of CollisionShape2D's functionality adding all of what is listed here: http://docs.godotengine.org/en/3.0/classes/class_area2d.html

to what is listed here: http://docs.godotengine.org/en/3.0/classes/class_collisionobject2d.html

Edit: meant CollisionObject not CollisionShape. Doh.

Yes for the first question.

You can use an Area in a race game to detect the winner, Area can use any collision shape as child node so you can choose a segment shape. If the car is a physic body (kinematic, rigid or area) you can detect if the segment is crossed. In a shoot them up an area for the space ship can be a good solution. Because even the kinematic body is overkill for that, you just need to detect if a bullet or an enemy enters in your ship.

The other bodies are nodes who inherit from "PhysicBody2D/3D" (the nodes are implemented with OOP) so a "body" can be a RigidBody2D/3D, KinematicBody2D/3D, Area2D/3D, StaticBody2D/3D (the most basic one used for walls or grounds). "Body" is just a generic name.

The collisionshapes are nodes added as childs of the bodies. The body node is pointless without this. Bodies nodes and collisions nodes works together. You can add as many collision nodes you want to a single body.

If you want to shake everything in the screen you can use a Node2D as root or as parent of everything you want to shake, i guess you don't want to shake the HUD. Then shake this Node2D (no idea how to script this but it surely possible with some vector maths).

Hi Jay

Everything in GODOT is a node, you can add anything to anything, sounds confusing at first but it's kind of freeing, if you want the node you are working on to have sounds ect. just drag soundplayer on to the node.

I totally agree with NeoD.

Staticbody is still - rocks, terrain ect. Hard stuff Rigidbody moving physics items - the player, enemies, bullets ect. Area2d triggers - coins, spikes, water, end of race, new level ect.