Before updating to Windows 10 you may need to return your Pro license. More information here

How can i make my camera move in 3 dimensions?

I would like to know how to make my camera move and rotate in z,x and y axels so i can use it in a space game. The first person Controller and 3rd person controller only move in one level, because they are designed for a game with floors. Can some1 plz help me?

more ▼

asked May 11, 2011 at 07:24 PM

avatar image

Esa Niemi
3 3 2 6

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

transoform.rotate (may also work) of couse you would still need to program the buttons and appy a force to move foward .

you can add constant force to move in which ever direction you are currently in.

The above code can be used to change the values of x, y and the z axis (by applying different values to the axis you want to alter.

The cursor keys could be set up for up and down movement and turning to the left and to the right. (stafling or side movements for when fighting could be applied to the v and b buttons as its near the space bar which could be used for moving fowards or shooting.

To move forwards (the z axis is often used)

Go to unity script refrence

Look at rigid body.apply realative force. Transform.translate Rotate.

To have utter control over a space ship you need to think about what do i actually want it to do (do i want my camera to rotate downwards when the player presses the down key , do i want the camerea to roatate in the air while climbing.

When roatating to move left and right how would apply this motion when using 2 buttons. what button do i need to make it move fowards . Do i need it to be able to reverse.

Hope this helps

more ▼

answered May 11, 2011 at 09:04 PM

avatar image

56 10 7 10

I like this approach, i was think that the camera could be focused on the mouse and shoot could be the clicking of the mouse, but just using the keyboard sounds intriguing. I'm going to have to play around with this :)

May 12, 2011 at 11:50 AM HHameline

Its what i am doing for my current project but having problems with a load system at this stage anything would do. (i am however changing from first person to third person, allowing the player to land and also play in first or third person all time.)

May 12, 2011 at 02:36 PM StephenLTGAMES

You mean like loading/saving the players progress?

May 12, 2011 at 04:07 PM HHameline

Its okay i got it to work to a degree but for some reason it only saved when i exited my pause menu.

May 14, 2011 at 04:05 PM StephenLTGAMES
(comments are locked)
10|3000 characters needed characters left

I think you want something like this:

using UnityEngine;

using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

public GameObject camera;

// Use this for initialization void Start () {


// Update is called once per frame void Update () { if (Input.GetKey("space")) { camera.transform.Translate(new Vector3(0, 10, 0)); } }


That will move the camera up in the y axis, when you press down the space bar.

more ▼

answered May 11, 2011 at 08:00 PM

avatar image

222 45 37 49

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: May 11, 2011 at 07:24 PM

Seen: 2589 times

Last Updated: May 11, 2011 at 07:24 PM