godotengine / godotengine/godot-visual-script

Make to_global function usable with transform datatype in Visual Script.

Open
#12 0 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
131
Forks
25
PR merge metrics
No merged PRs in 30d

Description

**Describe the project you are working on:**
I'm working on a 3D endless runner game. The player character in the game needs to lock onto an enemy in order to perform an attack.

**Describe the problem or limitation you are having in your project:**
Locking onto the freely moving enemy in 3D will usually require the transform functionality. However, even though Godot's Visual Script provides the transform function, it is incomplete as there is no way to get or set the **global value** of the transform function. ([read about it here](https://docs.godotengine.org/en/stable/tutorials/3d/using_transforms.html#introducing-transforms) and [here is the equivalence GDScript function](https://docs.godotengine.org/en/stable/classes/class_spatial.html?highlight=global_transform#class-spatial-property-global-transform)).

**Describe the feature / enhancement and how it helps to overcome the problem or limitation:**
By adding the ability to set, get, or convert the local transform value to the global transform value into Visual Script, I can access the global value of the transformed scene. Currently, it is impossible to access the global transform value with Visual Script.

**Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:**
An ability to convert the local value of the scene is already presented in the **to_global** node which can be used to convert the local Vector3 value to its global value. It would be nice for this node to be able to convert the local transform value to its global value as well.

**If this enhancement will not be used often, can it be worked around with a few lines of script?:**
This enhancement function (convert / access the global value) will be used very often. But it is currently impossible in Visual Script. The possible workaround I can think of is to use the _get_parent_ function over and over again until I can get to the scene in the global space to get the global value. However, the code will be very prone to break and I am not sure about the performance impact.

**Is there a reason why this should be core and not an add-on in the asset library?:**
The ability to access a scene's value is (and should be) the core of the engine.

![to_global function](https://user-images.githubusercontent.com/1403194/97645882-e0f57d00-1a2c-11eb-851c-e27e701122b6.jpg)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.