Skip to content

Commit

Permalink
Merge pull request #9 from xBambusekD/master
Browse files Browse the repository at this point in the history
Camera speed fix
  • Loading branch information
xBambusekD authored Jan 27, 2021
2 parents a35684e + dd85ffd commit 1fc60b3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
7 changes: 4 additions & 3 deletions VSTool/Assets/Scenes/CameraControlScript/CameraController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Expand All @@ -14,6 +14,7 @@ public class CameraController : MonoBehaviour {

public GameObject DroneGameObject;
public GameObject DroneModel;
public float CameraSpeed = 0.5f;

// Update is called once per frame

Expand Down Expand Up @@ -69,7 +70,7 @@ void Update () {
if(right)
moveHorizontal += 0.5f;

Vector3 rotace = new Vector3(moveVertical * -0.8f, moveHorizontal * 0.8f, 0);
Vector3 rotace = new Vector3(moveVertical * -CameraSpeed, moveHorizontal * CameraSpeed, 0);

//move up
// if (transform.localRotation.eulerAngles.x >= 90.0f && transform.localRotation.eulerAngles.x < 180.0f && rotace.x > 0) rotace.x = 0;
Expand All @@ -91,7 +92,7 @@ private void HandleCameraInputKeys()
{
float moveVertical = Input.GetAxis("CameraRotateY");
float moveHorizontal = Input.GetAxis("CameraRotateX");
Vector3 rotace = new Vector3(moveVertical * -0.8f, moveHorizontal * 0.8f, 0);
Vector3 rotace = new Vector3(moveVertical * -CameraSpeed, moveHorizontal * CameraSpeed, 0);
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + rotace);
}

Expand Down
19 changes: 6 additions & 13 deletions VSTool/Assets/Scenes/CameraControlScript/CameraZoom.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraZoom : MonoBehaviour
{
//bool isUpButtonPressed = false;
//bool isDownButtonPressed = false;

// Use this for initialization
void Start()
{

}

private bool zoom;
private bool unzoom;
public float ZoomSpeed = 0.2f;

// Update is called once per frame
void Update()
{
Expand All @@ -39,7 +32,7 @@ void Update()
scroll -=0.1f;
if ((transform.localPosition.z > -7 || scroll > 0) && (transform.localPosition.z < 0.8f || scroll < 0))
{
transform.localPosition = transform.localPosition + new Vector3(0, 0, scroll * 0.4f);
transform.localPosition = transform.localPosition + new Vector3(0, 0, scroll * ZoomSpeed);
}
}

Expand All @@ -49,11 +42,11 @@ private void HandleCameraInputKeys()
float zoomOut = Input.GetAxis("CameraZoomOut");
if(zoomIn > 0)
{
transform.localPosition = transform.localPosition + new Vector3(0, 0, zoomIn * 0.2f);
transform.localPosition = transform.localPosition + new Vector3(0, 0, zoomIn * ZoomSpeed);
}
if(zoomOut > 0)
{
transform.localPosition = transform.localPosition + new Vector3(0, 0, -zoomOut * 0.2f);
transform.localPosition = transform.localPosition + new Vector3(0, 0, -zoomOut * ZoomSpeed);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 1}
- _MainTex:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 3d8cc8aa2a7d98d4c8e5a74427db4332, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
Expand Down
4 changes: 3 additions & 1 deletion VSTool/Assets/Scenes/DroneScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 0.4
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.40971625, g: 0.4599883, b: 0.5173336, a: 0.4}
m_IndirectSpecularColor: {r: 0.44630373, g: 0.48284388, b: 0.5318522, a: 0.4}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -3131,6 +3131,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
DroneGameObject: {fileID: 195406341}
DroneModel: {fileID: 1175988866}
CameraSpeed: 0.06
--- !u!1 &170076733
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -36296,6 +36297,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c91847f54b530bb498fde791f4dde036, type: 3}
m_Name:
m_EditorClassIdentifier:
ZoomSpeed: 0.03
--- !u!1 &1986796486
GameObject:
m_ObjectHideFlags: 0
Expand Down
1 change: 1 addition & 0 deletions VSTool/ProjectSettings/GraphicsSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ GraphicsSettings:
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
Expand Down

0 comments on commit 1fc60b3

Please sign in to comment.