Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Esa Niemi · May 11, 2011 at 07:24 PM · 3dfirst-person-controllerspacegamecontroller

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by StephenLTGAMES · May 11, 2011 at 09:04 PM

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

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HHameline · May 12, 2011 at 11:50 AM 0
Share

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 :)

avatar image StephenLTGAMES · May 12, 2011 at 02:36 PM 0
Share

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.)

avatar image HHameline · May 12, 2011 at 04:07 PM 0
Share

You mean like loading/saving the players progress?

avatar image StephenLTGAMES · May 14, 2011 at 04:05 PM 0
Share

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

avatar image
1

Answer by HHameline · May 11, 2011 at 08:00 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

No one has followed this question yet.

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Move object towards mouse in full 3D space 2 Answers

How i can make a first person controller that doesn't get affected by gravity? 2 Answers

Reference boolean check from other script (not working) 1 Answer

Moving the first person controller upwards and downwards 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges