bonjour je suis en train de creer un platformer mais j'ai un pb avec les vecteurs serait'il possible de m'aider merci d'avance
voila le code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class new_script : MonoBehaviour
{
float x = 0.0f, y = 0.0f, z = 0.0f;
Vector3 firstLvl = new Vector3(4.0f, -3.8f, 0.0f);
Vector3 position = new Vector3(0.0f, 0.0f, 0.0f);
void Start()
{
}
void Update ()
{
position = transform.position;
if(position == firstLvl) {
print("ok");
}
//player moving
if (Input.GetKey(KeyCode.UpArrow))
{
y = 0.1f;
transform.Translate(x, y, z);
y = 0.0f;
} else if (Input.GetKey(KeyCode.DownArrow))
{
y = -0.1f;
transform.Translate(x, y, z);
y = 0.0f;
} else if (Input.GetKey(KeyCode.RightArrow))
{
x = 0.1f;
transform.Translate(x, y, z);
x = 0.0f;
} else if (Input.GetKey(KeyCode.LeftArrow))
{
x = -0.1f;
transform.Translate(x, y, z);
x = 0.0f;
}
}
}