- Home /
Jet bike is not moving forward.
Okay, so I'm making a jet bike game and I was having trouble with the terrain collision. I realized I was using Translate, and switched to using forces. Now my Character isn't moving forward. My character, by the way, is an empty parent with a number of various 3d objects and a camera for the children. All have Rigidbodies that use gravity and are Kinematic. Otherwise, the whole thing falls apart. Terrain does not have a rigidbody nor a collider. Code follows.
`using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float Speed;
private Rigidbody rb;
public float RotateSpeed;
void Start() { rb = GetComponent(); }
void FixedUpdate (){
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical") * Speed;
float rotateHorizontal = Input.GetAxis ("Horizontal") * RotateSpeed;
Vector3 movement = new Vector3(moveVertical,0f,moveHorizontal);
rb.AddForce(movement);
transform.Rotate (0f,rotateHorizontal,0f);
}
}'
$$anonymous$$inematic... $$anonymous$$ake them non $$anonymous$$inematic to move through force.