Hey, I am new to Unity and I am wondering how to do a few things. In my game I want to have a blimp/Airship that you can walk around on, and then when you are near the rutter control (the steering wheel) and you press a button (E) you control the Airship in a third person view. Airship flying statistics: W=up S=down A=turn left D=turn right. the ship is constantly moving forward but you can stop it by pressing spacebar.
I know its allot but in order to learn unity I need to look at examples like this.
Here’s a potential outline (there’s probably several ways to accomplish this):
Make an empty game object with a collider(trigger) and a script that is waiting for the player to press ‘E’ while the while character is triggering it.
This trigger script will then switch cameras to one that is planted conveniently behind the airship and flip a flag in the player controller script for the walking character OFF. Meanwhile the airship’s script also becomes active. Now it can look for key presses and move accordingly. (You’ll also want to either hide the character or “stick” the character to the airship.)
Does that help? Using that outline and doing some basic scripting homework should get your feet off the ground.
Thank you, but now I have another problem. How would I get it so that when you walk around the airship while its moving you don’t get flung off. EG. in a car while its moving forward you don’t really get pulled backwards, yet on the airship you get pulled in the opposite direction its moving.
another problem is the fact that I want the balloon to carry the ship so it never flips over, but I see no other way to get the airship to work other than rigidbody, but you can’t set weights in rigidbody. :?
How are you controlling the character? If you are just moving the transform, you will need to keep it in line with the airship manually.
If you are lofting the airship by using an upward force, use rigidbody.AddForceAtPosition to apply the force slightly above the centre of mass. If you do this, it will always be rotated so that the “weight” hangs downwards.