- Home /
Basic questions for moon landing game
Hello,
I have decided to make a moon landing game for my school project. Our school is using C# for scripting.
I am really lost at this point since this is my first ever game I am developing. I also think I have decided to make too complicated game. (I have pretty good understanding of physics... (When it comes to thrust, I may have problems...))
This is all the scrip I have applied for now:
using UnityEngine;
using System.Collections;
public class MoonPhysics : MonoBehaviour {
void Start () {
}
void Update () {
float thrust = Input.GetAxis("Vertical") * 10f;
rigidbody.AddForce(transform.up * thrust);
float rot = Input.GetAxis("Horizontal") * 10f;
rigidbody.AddTorque(0,0,rot);
}
}
I have 5 questions.
Have I chosen too difficult game? (I have about 5 weeks to develop this game)
I have created terrain and I have no textures... what is going on? (Using free Unity version)
How would I make the camera to track the TestShip (simple triangle acting as lunar module)
Is physics for rocket thrust complicated to script and apply to a module? Or should I just stick to built in physics functions and use 'force'?
I would like to be able to see altitude, speed and angular velocity etc.. how would I do that?
Thank you
Answer by robertbu · Jun 03, 2013 at 02:47 PM
I did a similar project with my daughter. What we did was pretty basic...a straight down landing with limited fuel and a velocity goal for a safe landing. Use too much fuel, and the module freefalls to it's death...too little and you hit too hard. We bypassed Unity's physics engine and used equations instead (for educational value). Day/hour one we developed a bounding ball using the equation. The actual lander project took an addition four days/hours to complete including the graphics time. But that is with me knowing the end goal, guiding, and helping her through the rough spots. She displayed altitude, fuel, velocity and acceleration.
The equation we used is:
Here is the key code she wrote based on that equation (executed in Update()):
float fDeltaY = fVelocity * Time.deltaTime + fAccl * Time.deltaTime * Time.deltaTime / 2.0f;
float fDeltaV = fAccl * Time.deltaTime;
v3Point.y = v3Point.y + fDeltaY;
fVelocity = fVelocity + fDeltaV;
transform.position = v3Point;
Rather than have the camera track the module (third person), she used the camera as the module looking down. Here is a screen shot from the game view.
Some answers to your question:
1) How long this will take you to finish will depend on the scope you your game and if you have anyone to help you through any rough spots. An experienced programmer could do it in a few hours, but it is not uncommon to get technical questions on this list from folks who say they have been stuck for a week on a single issue.
3) The easiest way for a camera to track the module is to make the camera a child of the lander, but there are a couple of standard tracking scripts that come with Unity (Smooth Follow and Smooth Look At) as well as numerous posts on UA with other solutions.
4) I gave you the equation, so it's not too complicated. Using build-in physics is easier.
5) These indicators will fall out of whatever solution you use. If you get stuck, come back with a specific question.