This post has been wikified, any user with enough reputation can edit it.
Question by
Samuel1324 · Dec 16, 2015 at 02:20 PM ·
controllercontrolscontrol
Why is my boat moving horizontal , when i scripted it for vertical ?
i am a bit new in unity , but i see a youtube tutorial and got the script for my purpose ( it worked ) but instead of moving vertical it is moving horizontal . help please !!!!
using UnityEngine;
using System.Collections;
public class Boat : MonoBehaviour {
public float turnSpeed = 10000f;
public float accellerateSpeed = 10000f;
private Rigidbody rbody;
// Use this for initialization
void Start()
{
rbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
rbody.AddTorque(0f, v * turnSpeed * Time.deltaTime, 0f);
rbody.AddForce(transform.forward * h * accellerateSpeed * Time.deltaTime);
}
}
Comment
Best Answer
Answer by vintar · Dec 16, 2015 at 05:51 PM
try : rbody.AddForce(transform.right* h accellerateSpeed Time.deltaTime);
Your answer
Follow this Question
Related Questions
White/Yellow line under Third Person Character? 0 Answers
Can anyone please tell what to do make a bomb explode on touching ? 1 Answer
DualShock 4 Horizontal axis stuck on -1 0 Answers
how can i make drag and release (like billiard games) ball control 1 Answer
Resident Evil 4 Style Aiming Window - Rotational Problem When Aiming 1 Answer