using UnityEngine;
using System.Collections;
public class player_control : MonoBehaviour
{
void fixedupdate()
{
float movehorizontal = Input.GetAxis(“horizontal”);
float movevertical = Input.GetAxis(“vertical”)
Vector3 movement = new Vector3(movehorizontal, 0.0f, movevertical);
rigidbody.addforce("movement")
}
}
2 Answers
2
Your code is littered with errors:
- fixedupdate should be FixedUpdate
- no semicolon following the movevertical assignment
- AddForce not addforce, and give it the variable
movement not the string “movement”
You might want to click the Learn tab and follow some basic tutorials.
you missed ; on the end of
rigidbody.addforce(“movement”)
– Wolfdogrigidbody.addforce("movement");don't forget semicolonsI did all you told me than this pops up Assets/scripts/player_control.cs(13,36): error CS0128: A local variable named `movement' is already defined in this scope
– sp4zdr3dd