Object moves automatically without any keystrokes [ SOLVED ]

Hello guys ,

i am trying to make a simple game where a user controls a boat , no levels nothing just a simple game where when the user presses a button the boat moves forward and vice versa…

i downloaded a boat model from the asset store and everything else .
but my problem is when i press play the boat starts to move in its own , like there is no way to control it .

i will include a video if ya guys want to in case if you don’t understand.

i am using the following script to control the boat :

using UnityEngine;
using System.Collections;

public class movement : MonoBehaviour {

	public float turnspeed = 1000f;
	public float acc = 1000f;

	private Rigidbody RB;

	// Use this for initialization
	void Start () {

		RB = GetComponent<Rigidbody>();
	// Update is called once per frame
	void Update () {

		float h = Input.GetAxis("Horizontal");
		float v = Input.GetAxis("Vertical");


there is no error in the console no compile errors nothing.

here is the video showing my problem : - YouTube


Everything in the script checks out, so I suggest for now attach that script to an empty cube, and add a plane ground. This is because I noticed in the video, those pre-made object have some scripts on them. See what happens then. If everything is good, check the differences between the sea object you have and the boat object.

Also, add a Debug.Log (Input.GetAxis("Horizontal") + " " + Input.GetAxis("Vertical")); to verify what Input.GetAxis is returning.

Lastly, please try to have a much clearer title, as people won’t help you if they have to read more than a sentence just to know IF they can help you, let alone what to help with.

@sachin_rocks ,whenever working with ridigbodies its suggested that you work within the FixedUpdate function as its more related to physic update rates.

Below is an example of a script i work for your instance that has been tested to work. You can edit the values in the inspector to get a good feel but ill post what mine looks like so you can see:

using UnityEngine;
using System.Collections.Generic;

public class BoatControl : MonoBehaviour {

	public Rigidbody boat;
	public KeyCode forwardMove;
	public KeyCode backwardMove;
	public KeyCode turnLeft;
	public KeyCode turnRight;
	public float boatSpeed;
	public float boatTurnSpeed;
	public float dampSpeed;
	public float dampTurning;

	public float forwardVel;
	public float turnVel;

	void Update() {
		MoveShip ();
		TurnShip ();

	void FixedUpdate() {
		boat.transform.position += transform.forward * (forwardVel * Time.deltaTime);
		boat.transform.Rotate (new Vector3 (0, turnVel, 0), Space.Self);

	void MoveShip() {
		if (Input.GetKey (forwardMove)) {
			forwardVel = Mathf.Lerp (forwardVel, boatSpeed, (dampSpeed * Time.deltaTime));
		} else if (Input.GetKey (backwardMove)) {
			forwardVel = Mathf.Lerp (forwardVel, -boatSpeed, (dampSpeed * Time.deltaTime));
		} else {
			forwardVel = Mathf.Lerp (forwardVel, 0, (5 * Time.deltaTime));

	void TurnShip() {
		if (Input.GetKey (turnLeft)) {
			turnVel = Mathf.Lerp (turnVel, -boatTurnSpeed, (dampSpeed * Time.deltaTime));
		} else if (Input.GetKey (turnRight)) {
			turnVel = Mathf.Lerp (turnVel, boatTurnSpeed, (dampSpeed * Time.deltaTime));
		} else {
			turnVel = Mathf.Lerp (turnVel, 0, (5 * Time.deltaTime));


Note, i also set my boats pivot near to the back of the model so i can simulate a rudder.

Let me know how this works for you.