Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MoveCameraSimple : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- if( Input.GetMouseButtonDown(0) )
- {
- gameObject.GetComponent<Rigidbody>().AddForce( new Vector3( 0, 1, 0 ) * 50 );
- }
- if( Input.GetKeyDown( KeyCode.W ) )
- {
- gameObject.GetComponent<Rigidbody>().AddForce( new Vector3( 0, 0, 1 ) * 50 );
- }
- if( Input.GetKeyDown( KeyCode.S ) )
- {
- gameObject.GetComponent<Rigidbody>().AddForce( new Vector3( 0, 0, -1 ) * 50 );
- }
- if( Input.GetKeyDown( KeyCode.A ) )
- {
- gameObject.GetComponent<Rigidbody>().AddForce( new Vector3( -1, 0, 0 ) * 50 );
- }
- if( Input.GetKeyDown( KeyCode.D ) )
- {
- gameObject.GetComponent<Rigidbody>().AddForce( new Vector3( 1, 0, 0 ) * 50 );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement