using UnityEngine;
using System.Collections;
public class Kugel : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.A))
rigidbody.AddTorque(0,0,50*Time.deltaTime)
if(Input.GetKey(KeyCode.D))
rigidbody.AddTorque(0,0,-50*Time.deltaTime)
if(Input.GetKey(KeyCode.W))
rigidbody.AddTorque(50,0,0*Time.deltaTime)
if(Input.GetKey(KeyCode.S))
rigidbody.AddTorque(-50,0,0*Time.deltaTime)
if(Input.GetKey(KeyCode.Space))
rigidbody.AddForce(0,0,-50)
}
}
“is = Unexpected symbol”
missing " ; " character at end of line with each rigidbody one.
e.g.:
using UnityEngine;
using System.Collections;
public class Kugel : MonoBehaviour {
void Update () {
if (Input.GetKey (KeyCode.A)) {
GetComponent<Rigidbody> ().AddTorque (0, 0, 50 * Time.deltaTime);
}
if (Input.GetKey (KeyCode.D)) {
GetComponent<Rigidbody> ().AddTorque (0, 0, -50 * Time.deltaTime);
}
if (Input.GetKey (KeyCode.W)){
GetComponent<Rigidbody> ().AddTorque (50, 0, 0 * Time.deltaTime);
}
if (Input.GetKey (KeyCode.S)){
GetComponent<Rigidbody> ().AddTorque (-50, 0, 0 * Time.deltaTime);
}
if (Input.GetKey (KeyCode.Space)) {
GetComponent<Rigidbody> ().AddForce (0, 0, -50);
}
}
}