unity camera movement script

using UnityEngine;

public class CameraController : MonoBehaviour {

    private float moveSpeed = 0.5f;
    private float scrollSpeed = 10f;

    void Update () {
        if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) {
            transform.position += moveSpeed * new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
        }

        if (Input.GetAxis("Mouse ScrollWheel") != 0) {
            transform.position += scrollSpeed * new Vector3(0, -Input.GetAxis("Mouse ScrollWheel"), 0);
        }
    }

}


4
1
Realdeo 110 points

                                    movement camera

4 (1 Votes)
0
4
10
Alkasm 110 points

                                    void Update()
 {
     if(Input.GetKey(KeyCode.RightArrow))
     {
         transform.Translate(new Vector3(speed * Time.deltaTime,0,0));
     }
     if(Input.GetKey(KeyCode.LeftArrow))
     {
         transform.Translate(new Vector3(-speed * Time.deltaTime,0,0));
     }
     if(Input.GetKey(KeyCode.DownArrow))
     {
         transform.Translate(new Vector3(0,-speed * Time.deltaTime,0));
     }
     if(Input.GetKey(KeyCode.UpArrow))
     {
         transform.Translate(new Vector3(0,speed * Time.deltaTime,0));
     }
 }

4 (12 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
unity player move to camera unity how to move main camera c# unity player movement camera how to move around in unity camera 3d character movement script unity with camera camera movement script with code unity how to program the camera to move move camera in unity how to move game camera in unity move camera c# unity camera view movement for player unity ui move with camera unity how to make camera move with player in unity camera movement control unity unity movement 3d with camera how to make a main camera move in unity with c# simple camera movement unity camera movemente unity unity camera movement script 3d unity free camera movement script running camera movement unity unity 3d free camera movement script camera movement script CAMERA MOVE IN UNITY unity move camera with was move camera unity instantly simple camera movement script unity3d 3d Camera movement script unity move camera w and a unity unity camera move with player camera move unity move camera with keys unity object move with camera unity camera movement unity 3d move with cam unity how to make it possible to move your camera in unity how to move camera with player in unity add camera movement in unity how to create a camera movement unity move camera in inspector unity move camera unity script move camera in code in unity how to move the camera in unity to player unity add movement to camera unity move camera with player How do I put the main camera in my script unity projection camera unity unity move camera to position how to move something with the camera unity 3d camera movement script unity 3d camera movement unity code camera movement unity c# how to move the camera to a different position in unity camera move unity script move camera with object unity how to move camera in unity with script 2019 how to move camera in unity with script move camera scirpt unity move camera position in script unity unity move camera script how to move in unity with your camera move camera with player unity unity 3d camera movement unity program camera movement how to make camera move around an object in unity how to move camera in editor unity unity script move camera how to make the camera move in unity unity move camera in editor unity simple camera controller basic camera movement unity unity script camera movement camera movement for building game unity unity 3d camera controller script move camera with mouse unity unity camera controller unity camera controller script unity camera control camera control unity unity c# 3d camera movement script move camera in unity with mouse move camera in unity mouse camera movement unity free open source camera movement script unity unity move player in direction of camera unity free cam script unity camera move unity move camera in game mode unity camera tremolante unity move camera smoothly unity swipe move camera c# camera movement C# camera movment camera mnovement code unity 3D camera movement unity move camefra unity3d how to move a camera using script in unity how to move a camera using scrpit in unity cameramvoement script unity unity3d camera movement script camera movement for unity moce camera in Unity add movement to camura unity camera moment in unity 3d 3d camera movement unity How to move Camera in unity unity 3d camera move how to move a camrea unity camera movement in unity camera move unity 3d Unity how to move camera better camera movement in unity how to move the camera unity how to move the camera in unity move camera unity unity camera movement code camera movement script unity unity c# camera movement script unity add camera movement unity camera move script how to make a camera move in unity hwot o move camera unity unity camera movement script unity camera movement unity move camera 3d movement with camera in unity camera movement unity move camera unity c# camera movement 3d unity unity move camera code how to use wasd to control rotation unity2d how to move around in the camera in unity how to code a move camera in unity
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source