First jump into 3D -- determining destination based on number of units foward

Godot Version

4.7.2

Question

Trying 3D for first time, so please bear with me.

Trying to do a very basic turn-based test case to help learn. basically everything on a 2D plane, so Y-axis not really being used.

Essentially, let’s say I have a simple MeshInstance3D actor in the game at Position 1, and I want to display a marker at Position 2 to show the player where the actor will end up if they “confirm” their currently selected movement. Let’s say the movement should be 3 units forward from the actors current facing, and then 1 unit to the right.

So far I’ve learned…very little trying to google out an answer. I’ve learned that the Z axis is essentially forward/backward from the perspective of the camera, but I’m interested in forward/backward based on perspective of the actor. It seems like there is a way to use transform so that modifying z will also be forward for the actor? I’m unsure.

Basically, I’m looking for the default way to determine the global_position of 2 by offsetting the global_position of 1, no matter if the actor facing directly away from the camera

x 2
x x
x x
1 x
[CAM]

or directly to the right

1 x x x
x x x 2
[CAM]

can anyone point me towards what documentation i should be reading through to understand this type of task? i’m feeling a bit overwhelmed and just need a good place to start.

Use global_basis of the actor.

Sorry, I’m not sure how exactly. I was hoping to be able to do something akin to:

# find destination of actor after moved 3 units forward and 1 unit to the right
var destination_position: Vector3 = actor.global_basis.transform(1, 0, 3).global_position

but that obviously doesn’t work

Move three units along the z axis of the basis and then one unit along the x axis.

var new_pos = actor.position + Vector3(1,0,-3)