- Home /
realistic spaceship control
good guys, first deskulpe traduçao the bad, I am Brazilian and to using the google translator. but anyway I am not good at programming but would like to know how to script and how to apply it. the case is for a space game where the aim of the cannons would be centered in the middle of the screen and the ship would have mov free scenario with the keyboard controls. what I'm getting is that the same result: https://www.youtube.com/watch?v=SmID66L9Y3M
I thank anyone who can help, right now.
and what about this: https://www.youtube.com/watch?v=iTEojkgcphg
this, W - accelerate, S - slow down, A and D - fly to left or right, Q and E - spin left or right. mouse cursor crosshairs course, CTRL - inertial flight, SPACE - after burner.
Please don't post comments as answers. Post comments by clicking the [add new comment] button, a window then open for you to type in. Answer fields are for answers only, as this is a knowledge base.
Here at Unity Answers, Answer means Solution, not Response.
Read this page : http://answers.unity3d.com/page/newuser.html
Please watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers
I have converted this one for you.
I assume there is an empty gameObject attached to the camera that the ship is lerping to : http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Lerp.html
Please consider following the advice given in the answers here. Do lots of little projects and tutorials before making a big project. This is actually faster than trying to do just a big project and learning everything as you go. Just do one thing, understand it, then learn something else.
Upvote for everyone =]
Here are some links I strongly suggest to all new users :
Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/
this is the YouTube link for the above as one playlist : http://www.youtube.com/watch?v=-oXYHNSmTxg&list=PL27B696FB515608D2&feature=plcp
That is good to get started. Then start with a small tutorial, this is a simple 2D space shooter : http://www.unityjumpstart.com/ProofOfConcept_1/ : click on the videos part1.mp4 part2,3,4 =]
I found another by Eric : http://wiki.unity3d.com/index.php?title=2DShooter : http://forum.unity3d.com/threads/7883-2D-shooter-tutorial
By then you should be getting the hang of things and starting to have ideas of your own. When you decide what kind of game you want to make, then look at each part you'll need. For example, if you want to make some terrain then walk around it with a character : http://cgcookie.com/unity/2011/12/05/introduction-to-character-controllers/
Basically then just search for tutorials, there are many out there, either written or on youtube.
the Unity Wiki tutorials : http://wiki.unity3d.com/index.php/Tutorials
A big list of tutorials : http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html
A very helpful 'site, all in C# : http://unitygems.com/
Helpful page with information on using Built-In Arrays and Lists (you'll need this later!) : http://www.unifycommunity.com/wiki/index.php?title=Which_$$anonymous$$ind_Of_Array_Or_Collection_Should_I_Use?
The unity wiki link above is very handy with lots of scripts and shaders too (just check out all the links down the left, and the tabs along the top : http://wiki.unity3d.com/index.php/Scripts )
http://answers.unity3d.com/questions/148211/list-of-frequently-asked-beginners-questions.html
http://forum.unity3d.com/threads/132628-How-to-help-the-Absolute-Beginner
If you know what kind of game you want to make, edit your question and write there what you are thinking of, then there may be a tutorial out there for that, Happy Coding =]
Answer by Kiloblargh · Jul 26, 2013 at 07:28 PM
A realistic space game is pretty easy to do; all you need is Input.GetAxis and Rigidbody.AddForce / AddForceAtPosition.
If you have written a script and you have a problem with what it is doing, then you should ask on Unity Answers, posting your properly formated script for us to look at. If you are just asking someone here to teach you how to program assuming no knowledge; no, go read some C# for beginners reference material. Or if you are asking someone here to program the game for you so you don't have to learn; again no.
I often tell Unity beginners to start with making something like Asteroids so you're starting in the right place- but, unless you take the time and effort to go look up everything you need to figure it out yourself, there is no point.
Answer by robertbu · Jul 26, 2013 at 07:33 PM
Hello to you in Brazil. Google translator did a pretty good job. I hope it does as well going the other direction.
What you are asking for is code to solve multiple technical problems. This is not what UA is all about. We help you solve individual technical issues so you can write your own code. The script for the ship movement in the video is fairly sophisticated. Here is a simple script you attach to the camera to get you started:
#pragma strict
var speed = 75.0;
function Update() {
var v3 = Vector3(Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"), 0.0);
transform.Rotate(v3 * speed * Time.deltaTime);
}
As for shooting, there are a huge number of posts on UA. Google for combinations of 'unity3d', 'shoot', 'projectile', 'bullet', 'raycast', 'spawn point'. The one tricky part of your problem is that the bullet is aimed from the center of the screen, but it is shot from someplace else. To make this happen, you can raycast to find the position in 3D space hit, then you can use a Transform.LookAt() on the spawn point to aim the bullet in the correct direction.
Answer by JuanseCoello · Jul 27, 2013 at 02:23 AM
You can download the book, "Unity 3 Game Development Hotshot" with the scripts codes. to make your airplane shoot, just investigate and change the player with the airplane. It also teaches a lot of helpful stuff to start programming.
Answer by hardcorebadger · Feb 28, 2018 at 09:10 PM
This asset looks right along these lines, its super smooth and also fully commented so you could check that out - worked as a great base for my space game, then I built it up from there adding guns, etc.
Your answer
Follow this Question
Related Questions
2D Realistic Space Collision. 1 Answer
Simulating Rocket stage separation. 0 Answers
Keeping track of lots of entities 2 Answers
Traffic transport system in 3D space 0 Answers
Is SkyBox still the way to go? 1 Answer