-
What do you want to achieve? Keep it simple and clear!
I’d like to copy cframe values from a saved database and apply them to the currentcamera -
What is the issue? Include screenshots / videos if possible!
Any way I have tried applying the CFrame values, they always turn into 0’s … my latest attempt is below. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Much iterative sweat and many pleas to Google
The CFrame is retrieved in string format from the Datastore and looks like this:
location = "181.934998, 31.7661476, -178.768829, 0.914765835, 0, 0.403984576, 0, 1, 0, -0.403984576, 0, 0.914765835"
I turn that into a variable called ‘coordinates’ and then split it like this:
local coordinate_parts = string.split(location, " ")
then I populate the CFrame on the currentcamera like so:
camera.CFrame = CFrame.new(coordinate_parts[1],coordinate_parts[2],coordinate_parts[3],coordinate_parts[4],coordinate_parts[5],coordinate_parts[6],coordinate_parts[7],coordinate_parts[8],coordinate_parts[9],coordinate_parts[10],coordinate_parts[11],coordinate_parts[12])
testing the .split like this:
print(coordinate_parts[1]) -- expected value is returned
The problem: the currentcamera.CFrame is always (0,0,0,0,0,0,0,0,0,0,0,0)
Thanks!!!