UI that follow objects in your game

  Рет қаралды 3,742

Ombarus

Ombarus

Күн бұрын

Here's a few ideas on how to make a floating UI element follow objects in the world. Depending on performance, type of UI and such you might need different solutions so I decided to show a few of the ones I experimented with in Godot for my game Solar Rogue.
******* www.solar-rogu... *******
STEAM ► store.steampow...
ITCH.IO ► ombarus.itch.i...
ANDROID ► play.google.co...
IOS ► apps.apple.com...
************************************************
Follow me and support me, check out these links :
Support me on Patreon ► / ombarus
Join the discussion on Discord ► / discord
Twitter ► @Ombarus1
Instagram ► / ombarus1
Website ► www.ombarus.com
Email ► ombarus.dev@gmail.com
Github ► github.com/Omb...
Music ► www.bensound.com
My name is Ombarus and I'm a programmer / game developer from Canada who moved to Japan and decided to try my own luck with game dev.

Пікірлер: 12
@TackerTacker
@TackerTacker 3 жыл бұрын
You could take a look at the RemoteTransform2D Node which has an option to update positional information only. That could be pretty tedious though, I think the best solution would be to make a feature request on GitHub, for something similar to the selective transformation updates that the RemoteTransform2D Node has, but make it a standard Node2D and Node3D/Spatial property ( maybe a drop down menu, similar to the one on the pause property, but for every transform type ) That could bring so many new possibilities :O
@TackerTacker
@TackerTacker 3 жыл бұрын
Well... a drop down menu for position, rotation, and scale could be a bit much. It could just be a check-mark if it should Inherit from the parent or not.
@Produno
@Produno 3 жыл бұрын
I done something similar though i added every ui element i wanted to scale into a group, then called that group on my camera script whenever i zoom the camera, then do whatever i need there. It saves having to put a script on every one. Also you could use a visibility notifier to see if the object is on the screen to determine whether to process it or not.
@Ombarus
@Ombarus 3 жыл бұрын
I always underestimate groups. Great idea, thanks!
@NeZversSounds
@NeZversSounds 3 жыл бұрын
CanvasItem.set_as_toplevel() Would mean the child is in the owner's scene but acts as it is outside.
@KumsalObuz
@KumsalObuz 3 жыл бұрын
I thought of the same thing but he might have other concerns that might have got in the way of using such a simple command. Oh, the joy of programming.
@abcababca3796
@abcababca3796 3 жыл бұрын
You can use a RemoteTransform2D node for it (add it as a direct child of a Player etc. and make it update some Control's (global) position/scale/rotation based on the settings you've set). Not sure if it's faster but seems simpler to set up.
@Ombarus
@Ombarus 3 жыл бұрын
I wonder how it behave if the Control is inside a different CanvasLayer, I'll have to test it out. Thank you for the suggestion
@gingerageousgames613
@gingerageousgames613 3 жыл бұрын
That was my first thought too but I haven't tried it.
@abcababca3796
@abcababca3796 3 жыл бұрын
@@Ombarus RemoteTransform2D uses only local/global transforms so in general it won't work for different CanvasLayers. It would work for different CanvasLayers only if they would have the same canvas layer transform. Here's the relevant source code: github.com/godotengine/godot/blob/31d0f8ad8d5cf50a310ee7e8ada4dcdb4510690b/scene/2d/remote_transform_2d.cpp#L47 It shouldn't be hard to create a custom analogous node that takes also canvas transforms into account though. But there's still a question whether it's a preferable solution.
@Smaxx
@Smaxx 3 жыл бұрын
This sounds like a perfect use case for inheritance. For example, rather than attaching your "prevent scaling script" to multiple instances of Label, subclass Label as UnscaledLabel once and instantiate that one instead (or change the other Label's node type to this). Something like this: extends Label class_name UnscaledLabel # code for behavior follows here
@dorktales254
@dorktales254 2 жыл бұрын
Isn't there like billboarding in Godot
Should you use C# with Godot?
8:31
Ombarus
Рет қаралды 31 М.
Did I make money selling my game?
15:23
Ombarus
Рет қаралды 4,9 М.
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 31 МЛН
小丑家的感情危机!#小丑#天使#家庭
00:15
家庭搞笑日记
Рет қаралды 30 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 40 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 8 МЛН
How to Manage Popup and Dialogs in your Game
14:53
Ombarus
Рет қаралды 971
Mirror's Edge Any% TAS
21:55
Req
Рет қаралды 11 М.
THIS Is The Key To Good UIs in Godot
9:39
Mina Pêcheux
Рет қаралды 4,2 М.
How to Improve Your Camera for Platformers in Godot 3.1
7:41
Game Endeavor
Рет қаралды 23 М.
Can I Remake Super Mario World in Godot? (Part 1)
18:44
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 688 М.
Simple Car AI Driver in Unity!
13:17
Code Monkey
Рет қаралды 66 М.
How to Code a Pause in Godot (tutorial)
7:44
GDQuest
Рет қаралды 50 М.
I made a game using Godot for the first time
7:35
shawcat
Рет қаралды 1,2 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 31 МЛН