Change default node2d select-able size?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By flu
:warning: Old Version Published before Godot 3 was released.

EDIT: So it seems there is no simple fix for this? I’ve submitted this as an issue on the Godot GitHub, so we’ll see what happens. But! I am open to hearing any tips you all have!
/EDIT

Hi everyone! I’ve been using Godot now for a few weeks and it’s awesome! Very intuitive and well-made software. Thanks to everyone working hard on it and all those helping others.

My question: Is there a way to change the default select-able area of a node? I like to make lo-resolution pixel games, and it seems many nodes select size (Node2d, kinematic body, area2d) default to 64x64. I might be missing something very obvious, but here’s an image of my test game I’m working on:

The tile size is 16x16 and it gets very difficult to select the right thing (though the drop-down select menu helps!) Is there any way to get the select area to be like the image on the right? The player root in this case is a kinematic body, but I have the same issue right now with area2d and node2d.

A few things I’ve tried:

Make the sprite the root node – It seems this is not suggested practice and I imagine it makes it difficult to keep the sprite synced to the hitbox, rotation, etc.

Scale the root node down – this scales down every node it’s a parent of, so it’s a no-go. Or is there a way for child nodes to ignore the parent’s scale? And I don’t see a size box for kinematic/area/node2d nodes.

If there is no solution, might I suggest a feature? Maybe in the project settings there could be a “default node size” that you could set? It would help making lo-res pixel games a ton if it was possible to work in the game’s tile-size! Or maybe add the ability to choose the size of these kinds of nodes, independent of scale.

Sorry for the ramble, and thanks in advance!

I have submitted an issues https://github.com/godotengine/godot/issues/1544

puppetmaster- | 2016-04-06 07:05

Okay, cool. It seems there is no way to change the size. Your issue settled on snapping nodes to center but this problem would still be there – maybe I should submit my issue – setting a default node2d size – as a request on Github as well? Thanks!

flu | 2016-04-06 21:59

:bust_in_silhouette: Reply From: neikeq

You can override Rect2 CanvasItem::_get_item_rect() in your node script.

Assuming the node is a CollisionObject2D or any other node with a Sprite as child, you can do this:

func _get_item_rect():
    return get_node("my_sprite").get_item_rect()

Your script must have tools enabled.

Yes! This works well! I still think it’d be neat to be able to set a new default, instead of manually overriding every object, but this helps so much!

Thanks :slight_smile:

flu | 2016-04-07 17:53