I restarted my rocket ship because i messed up in the lecture about making the rocket look spiffy, so I created a new prefab and applied all the settings, audioSource, rigidbody, and scripts to it. However when I try to test it my rocket doesn’t move. I messed up somewhere while restarting my rocket ship, can someone please helpe me.
Hi user123,
Welcome to our community!
Without knowing anything about your project, I’m afraid it is difficult to help you with this problem. Could you please share screenshots of what you did and see in Unity?
Generally, a game object that’s supposed to get moved via a Rigidbody needs:
- a Rigidbody component
- your own script component with
- code that accesses the Rigidbody object
- code that modifies the Rigidbody object, e.g. by calling AddRelativeForce.
See also:
- Forum User Guides : How to apply code formatting within your post
- Forum User Guides : How to mark a topic as solved
Your Inspector looks fine. The rocket has everything it needs.
Have you already compared your Movement class to Rick’s? And have you already tried to add Debug.Logs to your code to see what is going on during runtime?
Since the gravity is pulling your rocket down, your thrust
value must be high enough. Otherwise, the rocket will not fly.
Everything is the same as Rick’s and the thrust value is already high enough but I still don’t know what’s going on.
Where exactly did you change the thrust
value? If you assign a script to the Inspector of a game object, the Inspector controls the component. If you exposed a variable in the Inspector, the Inspector controls the value of that variable, even if you change the value in your code.
And where did you add the Debug.Logs? What did you figure out with Debug.Log
?