I'm having a hard time with unity trying to translate a simple object. The object move in a 3 dimension world but only on the x and z axis. The function I'm using is the Translate function of my transform of my gameobject. x and z are the position I'm trying to move my object.
transform.Translate (( new Vector3(x - transform.position.x ,0,z - transform.position.z)).normalized * Time.deltaTime * speed,Space.World);
So here's the problem I'm dealing with : If the result of my calcul is the following Vector : (0,0,-1.0)
, my object move slowly in the wrong direction.
Example :
Starting position (25.16, 1.0, 12.0)
Final position after the translate function : (25.6, 1.0, 12.1)
Any help would be appeciate to help me understand this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…