0 votes

i'm trying to save a 3d player's location by making him touch a save point within a game and then load it again from where it was .
but i don't know how to find the player's coordinates ( x ,y ,z ) to save it .
i watched in youtube and i tried with this code :

i think the error in position

to save :

var game_data = { }
var x = Position3D

func ready():

func savedata():
var file = File.new()
file.open(savefile, File.WRITE)

to load :

var file = File.new()
if not file.file
data = {

        x = Position3D

file.open(save_file, file.READ)
game_data = file.get_var()

if he touch the save point , it will turn it into a scene " save a game "
there are two buttons yes and no
what i do in the yes button?

please help

Godot version Godot_v3.4.4-stable_x11
in Engine by (17 points)
edited by

1 Answer

+1 vote

The ways you get position in godot are for 3D


for anyone looking this up in the future the equivalent for 2D is

by (3,321 points)

thanks but didn't know how used it

i wont to store it's value inside a var and save it

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.