- Home /
rigidbody AddForce(transform.left) error
For some reason, whenever I try to run this code it says that transform does not have a definition for left. I have been looking at this code for ages and I still can't see anything wrong with it. Here is the code.
using UnityEngine;
using System.Collections;
public class Bounce : MonoBehaviour {
public float thrust;
public Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
rb.AddForce(transform.left * thrust);
}
// Update is called once per frame
void FixedUpdate () {
}
}
Answer by tanoshimi · Jul 05, 2015 at 07:47 PM
Transform doesn't have a left - I'm not sure how the error could have been more descriptive... http://docs.unity3d.com/ScriptReference/Transform.html
Try -transform.right instead.
Well there was no need to be so narky about it. I naturally thought there would be a transform.left as well and was caught be surprise when it t didn't work!
Thankyou though for supplying a solution.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Prevent DictationRecognizer from Timing Out? 0 Answers
SceneLoading and Coroutines 0 Answers