Fixed camera bug
This commit is contained in:
@@ -40,7 +40,7 @@ Material:
|
|||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- _MainTex:
|
- _MainTex:
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 2800000, guid: a1098147222c244469432bd59accf111, type: 3}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- _MetallicGlossMap:
|
- _MetallicGlossMap:
|
||||||
|
|||||||
@@ -745,6 +745,7 @@ MonoBehaviour:
|
|||||||
player: {fileID: 1644583845}
|
player: {fileID: 1644583845}
|
||||||
pivot: {fileID: 1339349186}
|
pivot: {fileID: 1339349186}
|
||||||
offset: {x: 0, y: 1, z: 7}
|
offset: {x: 0, y: 1, z: 7}
|
||||||
|
target: {fileID: 1644583845}
|
||||||
--- !u!81 &485207309
|
--- !u!81 &485207309
|
||||||
AudioListener:
|
AudioListener:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -5048,6 +5048,7 @@ MonoBehaviour:
|
|||||||
player: {fileID: 741217456}
|
player: {fileID: 741217456}
|
||||||
pivot: {fileID: 1402695046}
|
pivot: {fileID: 1402695046}
|
||||||
offset: {x: 0, y: 1, z: 7}
|
offset: {x: 0, y: 1, z: 7}
|
||||||
|
target: {fileID: 741217456}
|
||||||
--- !u!1 &1013482114
|
--- !u!1 &1013482114
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -453,6 +453,7 @@ MonoBehaviour:
|
|||||||
player: {fileID: 1885424384}
|
player: {fileID: 1885424384}
|
||||||
pivot: {fileID: 306905843}
|
pivot: {fileID: 306905843}
|
||||||
offset: {x: 0, y: 1, z: 7}
|
offset: {x: 0, y: 1, z: 7}
|
||||||
|
target: {fileID: 1885424384}
|
||||||
--- !u!81 &373154428
|
--- !u!81 &373154428
|
||||||
AudioListener:
|
AudioListener:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ MonoBehaviour:
|
|||||||
player: {fileID: 1759649041}
|
player: {fileID: 1759649041}
|
||||||
pivot: {fileID: 677662898}
|
pivot: {fileID: 677662898}
|
||||||
offset: {x: 0, y: 1, z: 7}
|
offset: {x: 0, y: 1, z: 7}
|
||||||
|
target: {fileID: 1759649041}
|
||||||
--- !u!81 &49708966
|
--- !u!81 &49708966
|
||||||
AudioListener:
|
AudioListener:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class CameraController : MonoBehaviour
|
|||||||
public Transform player;
|
public Transform player;
|
||||||
public Transform pivot;
|
public Transform pivot;
|
||||||
public Vector3 offset;
|
public Vector3 offset;
|
||||||
|
public Transform target;
|
||||||
|
|
||||||
void Start () {
|
void Start () {
|
||||||
if(!useOffsetValues){
|
if(!useOffsetValues){
|
||||||
@@ -20,7 +21,7 @@ public class CameraController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
pivot.position = player.position;
|
pivot.position = player.position;
|
||||||
pivot.parent = null;
|
pivot.parent = target.transform;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,8 +41,8 @@ public class CameraController : MonoBehaviour
|
|||||||
controllerCamY = Input.GetAxisRaw("Right Stick Y") * (rotateSpeed * 200.0f) * Time.deltaTime;
|
controllerCamY = Input.GetAxisRaw("Right Stick Y") * (rotateSpeed * 200.0f) * Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
pivot.Rotate(0, mouseCamX, 0);
|
target.Rotate(0, mouseCamX, 0);
|
||||||
pivot.Rotate(0, controllerCamX, 0);
|
target.Rotate(0, controllerCamX, 0);
|
||||||
|
|
||||||
if (invertY){
|
if (invertY){
|
||||||
pivot.Rotate(mouseCamY, 0, 0);
|
pivot.Rotate(mouseCamY, 0, 0);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class FloorLevel : MonoBehaviour
|
|||||||
script.lives = 3;
|
script.lives = 3;
|
||||||
script.finished = false;
|
script.finished = false;
|
||||||
respawn();
|
respawn();
|
||||||
script.pivot.transform.Rotate(0.0f, 225.0f, 0.0f, Space.Self);
|
script.pivot.transform.Rotate(0.0f, 0.0f, 0.0f, Space.Self);
|
||||||
levelBuild();
|
levelBuild();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class WaypointRace : MonoBehaviour
|
|||||||
script.lives = 3;
|
script.lives = 3;
|
||||||
script.finished = false;
|
script.finished = false;
|
||||||
respawn();
|
respawn();
|
||||||
script.pivot.transform.Rotate(0.0f, 225.0f, 0.0f, Space.Self);
|
script.pivot.transform.Rotate(0.0f, 0.0f, 0.0f, Space.Self);
|
||||||
levelBuild();
|
levelBuild();
|
||||||
waypointPlacement();
|
waypointPlacement();
|
||||||
countdown = Time.time;
|
countdown = Time.time;
|
||||||
|
|||||||
Reference in New Issue
Block a user