Godot has the
distance_to methods for
Vector2 but what would be the best way to get the distance from a 3d node to a 2d node? For example, I’m looking to see how far away the 3d kinematic body is from a 2d text label.
Currently, I’m trying something like:
var player_global_origin = player.global_transform.origin var player_vec2 = Vector2(player_global_origin.z, player_global_origin.x) var distance_to_label = player_vec2.distance_to(label.get_global_transform().origin)
Which seems to work ok when just moving forwards and backwards but it feels like it’s easy to break.
Apparently I don’t understand real time lighting. I have an interior scene with some windows. The light is from an OmniLight near the ceiling, default environmental light from outside, and a desk lamp with emission. Without baking light, the scene looks like this:
Consistent with the documentation for emission, the desk lamp is not affecting the surrounding objects. I want to bake the light to see the lamp’s effect and to support low end hardware.
I followed the baked lightmaps tutorial and set the BakedLightmap’s extents to encompass the entire room. After baking, the scene looks like this:
I can see the lamp’s light, as expected, but now everything is too dark. It is unclear to me from Godot’s documentation if scenes include indirect light without baking. I have tried this with the OmniLight set to bake "all" and only indirect light.
What am I missing here?
i have added some basic movement and some manual interpolation to a cube tat is a kinematic body in GODOT
extends KinematicBody var speed : int = 10 var slowdown_buffer = 0.2 var movement = Vector3(0,0,0) func _ready(): pass func interpolate(): if movement.x > 0: movement.x -= slowdown_buffer elif movement.x < 0: movement.x += slowdown_buffer else: movement.x = 0.0 func _physics_process(delta): if Input.is_action_pressed("left"): movement.x = -speed elif Input.is_action_pressed("right"): movement.x = speed else: interpolate() move_and_slide(movement)
The problem is that when i move the cube using the A and D
After the Cube stops after the interpolation , it starts moving in the opposite direction in a non increasing speed
How to fix this
I am very new to Godot and coding in general, so I apologize in advance for any simple mistakes. I am trying to have my text display the variable "ammodisplay" on my object "Marine." When I launch the game, the text sets to 7 (the correct value) but as I play the game and the variable changes, the text does not update with it. Any insight as to how I can fix this? Thanks in advance!
extends Label var NODE = load("Marine.tscn") var ammo = NODE.instance() var ammod = ammo.ammodisplay func _process(delta): text = (str(ammod)) ```
Since FNT is a bitmap font I was thinking perhaps making the padding negative to the right and left side of the characters and rasterizing each glyph already skewed by an angle could make the font appear to be tilted. Does any one know whether FNT sports negative padding or whether Godot support some form of skewing that could accomplish that?
Please take a look at the image to see what I’m describing
E.g I have changed the scale and rotation of a
MeshInstance and I want the editor and GDscripts to accept new settings as scale 1 and rotation 0 degrees in all axes.
I’m porting an old BuidBox 2 game to the Godot game engine. I already added all assets and scenes to the Godot project. The game is a 2.5D (isometric) endless runner. What I want now is to add a mechanism to load the next scene offscreen, remove the player’s character from the current scene, and add it to the next scene seamlessly, without breaking the game physics or causing the player character to go behind or in front of other game objects that it’s not supposed to.
For instance if I have this scenes:
Scene1 |-bg |-player └-fg Scene2 |-bg |-player └-fg
I would like to load
Scene2, remove player from
Scene1 and replace
Scene2 with the player node I removed from
Scene1, without the player node changing its velocity or position abruptly in the physics world or appearing behind the
bg node in
Scene2 or in front of the
fg node in
I used WebM video in my game but it’s lagging. The audio is few secs delayed then video. Is there any way to load the video first then play so that the lagging doesn’t occurs
This is my first question on this community and sorry if I will be a bit unclear. At first this is not a question for any solution about certain problem, I just want to listen some advice about changing a game engine.
I am unity developer for 2 years and I really love to make games, but there are some things which makes me feel little uncomfortable (for example pricing for unlocking some features, or being closed source). And that’s why I am thinking about changing working environment from unity to Godot. If there is someone who have done such thing before please let me know if it worth to invest my time into a new engine, or what difficulties will I encounter if I will give up unity and move to Godot.
Once again sorry if this is irrelevant post for this site or I am not clear enough.
In my Scene I have a Node2D. I then Instanced the Player and Area2D nodes. The Area2D has a signal pointing to itself that prints test when ran. Here is
the Code For the Area2D. Nothing happens when object enters Area2D
extends Area2D # Declare member variables here. Examples: # var a = 2 # var b = "text" # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass func _on_Area2D_area_entered(area): print('test')
Level Scene Player Area 2D
Google Drive Link to Project: https://drive.google.com/drive/folders/1OG3BBqKJzC3Je_r5eQdqiFUp7PzzBmt1?usp=sharing