Hi everyone!
(This this my first post here, been reading a lot! Thank you for all of the help already )
I am working on a Tetris clone, learning/practice project. I have some experience with game engines such as ue4, but this is first thing I am trying to do with Godot.
I have the whole thing sort of put together.I first made a 2d version, now I am trying to convert it to 3d,... it is somewhere in-between atm ^^. I started facing some difficulties when I started figuring the 3d transforms for Spatial nodes.
Tetromino
My Tetrominos are currently made out of tiles which are instanced Spatials. I do create those at run time and parent them to another root node, which is also a Spatial. For each tile in tetromino I have added .translation offset. When I rotate the tetromino I do rotate the parent node. This whole system is probably not the smartest thing but it is the current state of things.
Problem:
what I am trying to achieve:
I am just simply trying to drop an array of objects to world.z direction.
How it is behaving now:
When i try to set translation to tiles it is transforming objects to various directions. I assume there is local rotation and everything moves in their own "space"
Solution to this is probably something very simple but I seem to be missing something. TLDR: How to move something -Z in World Space. and ignore the something rotation.
This works but I am pretty sure this is not how it should be done ^^.
for t in tiles:
var stored_origin = t.global_transform.origin
if t.get_parent():
t.get_parent_spatial().remove_child(t)
t.global_translate(stored_origin + drop_offset)
add_child(t)