Hello there…
i have some problem to place an object to the coordinates, where first save in a PHP database.
first of all:
my script save the hit.point, of an object, that i place with raycast:
the hit.point have this format: (xx.xxxx,yy.yyyy,zz.zzz) always WITH ()
so i convert to a string:
koordinaten = hit.point.x.ToString()+","+hit.point.y.ToString()+","+hit.point.z.ToString();
Then i save it with a function :
function candle_speichern () {
var form = new WWWForm();
form.AddField("myform_name",koordinaten);
print(koordinaten);
var w = WWW(URL_save, form);
yield w;
if (w.error != null)
print(w.error);
else
print("Saved");
}
Then i want to load this entry, when i start:
var URL = "http://mydomain.de/read_candle.php";
var candle : GameObject;
static var eintrag: String;
function Start () {
candle_load();
}
function candle_load() {
var w = WWW(URL);
yield w;
if (w.error != null)
print(w.error);
else
eintrag = w.text;
print("Eintrag:"+eintrag);
var words = eintrag.Split(","[0]);
for(i = 0; i < words.Length; i++){
var load_x: int = float.Parse(words[0]);
var load_y: int = float.Parse(words[1]);
var load_z: int = float.Parse(words[2]);
print("Split x: "+load_x);
print("Split y: "+load_y);
print("Split z: "+load_z);
//var c_posx = float.Parse(load_x);
//var c_posy = int.Parse(load_y.ToString());
//var c_posz = int.Parse(load_z.ToString());
//print("x float: "+c_posx);
//print("y float: "+c_posy);
//print("z float: "+c_posz);
var position = Vector3(load_x, load_y, load_z);
print("POsition:"+position);
Instantiate(candle, position, Quaternion.identity);
}
}
i received allways this error:
FormatException: Unknown char:
System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider)
System.Single.Parse (System.String s)
start+$candle_load$15+$.MoveNext () (at Assets/Scrips/start.js:23)
**and the object was not positioned on the terrain, but the coordinates where true an i see it with the print command…but i dont know why and where i can solve this problem…
do you have any ideas?? Or exist’s another way to save and load the coordinates from an object?
thx a looooot!!**