Etant débutant, j'ai créé un script de toute pièce via la doc. Malheureusement j'ai des erreurs dans la console qui, bizarrement me permettent de lancer quand même la simulation.
Voici mon code :
Code : Tout sélectionner
#pragma strict
var rb: Rigidbody;
var fwd = transform.forward * 100;
var right = transform.right * 100;
function Start () {
rb = GetComponent.<Rigidbody> ();
}
function Update () {
if(Input.GetKey(KeyCode.Z)){
rb.AddForce(fwd);
}
if(Input.GetKey(KeyCode.S)){
rb.AddForce(-fwd);
}
if(Input.GetKey(KeyCode.Q)){
rb.AddForce(-right);
}
if(Input.GetKey(KeyCode.D)){
rb.AddForce(right);
}
}
Code : Tout sélectionner
get_transform can only be called from the main thread.
Constructor and field initializers will be executed from the loading thread when loading a scene.
ArgumentException: get_transform can only be called from the main thread.
Constructor and field initializers will be executed from the loading thread when loading a scene.