|
How would i go about making a plane-like thing, where the mouse pointer controls direction, and space bar controls thrust?? If anyone can help with a script i could expand on that'd be great. I have tried this now:
But It didn't work. Any Ideas?
(comments are locked)
|
|
Here:
Also if Oh and if you want to be able to rotate:
To rotate use left/right arrow keys or A/D what language is the above code written in? I get compiler errors for this script. Error 1: A namespace can only contain types or namespace declarations. Error 2: Parsing Error They both reference your first line of code: fuction Start() { Any help is greatly appreciated. Thanks.
Feb 12 '12 at 11:09 AM
shawnkilian
That's in JavaScript. The error is because "function" is misspelled.
Apr 29 '12 at 04:06 PM
nixtwiz
(comments are locked)
|
|
This is pretty much a duplicate question (except for the mention of mouse/space bar for the controls), so see this answer for more detail about how to implement flight physics in general. To read the Mouse movement, you'd want to lock the cursor, and use Input.GetAxis to read the horizontal and vertical movements of the mouse, like this:
You'd then want to use the "x" variable as the basis for the amount of torque you apply to control banking (as mentioned in the answer linked above), and the "y" value to control the amount of torque applied for *pitch control. To read whether the space bar is currently pressed, use: Um, how would i link up the mouse part to actually controll the banking? Any example?
Apr 16 '10 at 10:23 PM
Fishman92
Check my answer!
Jul 13 '10 at 07:16 PM
fireDude67
(comments are locked)
|
