Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

Commit 7c7f49dc authored by Jenny's avatar Jenny
Browse files

centered cam more

parent a4a24203
......@@ -7031,6 +7031,16 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1331997589998715973, guid: 2342577add2bab844a55e25cc4fea601,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1331997589998715973, guid: 2342577add2bab844a55e25cc4fea601,
type: 3}
propertyPath: m_LocalPosition.z
value: -4
objectReference: {fileID: 0}
- target: {fileID: 1331997591070191852, guid: 2342577add2bab844a55e25cc4fea601,
type: 3}
propertyPath: QiCount
......@@ -7046,6 +7056,11 @@ PrefabInstance:
propertyPath: locator
value:
objectReference: {fileID: 0}
- target: {fileID: 1331997591070191852, guid: 2342577add2bab844a55e25cc4fea601,
type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1331997591070191853, guid: 2342577add2bab844a55e25cc4fea601,
type: 3}
propertyPath: m_Name
......
fileFormatVersion: 2
guid: 1bd3cbc881553d547bddcc6d90962a1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 53a7317f1cae7884ea0ad69101a05cf8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1270904031161397415
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1270904031161397466}
- component: {fileID: 1270904031161397413}
- component: {fileID: 1270904031161397412}
- component: {fileID: 1270904031161397464}
m_Layer: 0
m_Name: Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1270904031161397466
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1270904031161397415}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5.5063953, y: 4.8508096, z: 2.3012662}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &1270904031161397413
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1270904031161397415}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &1270904031161397412
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1270904031161397415}
m_Enabled: 1
--- !u!114 &1270904031161397464
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1270904031161397415}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 37f2e6545c16a9545bab9e357db06531, type: 3}
m_Name:
m_EditorClassIdentifier:
Distance: 10
Height: 2
Sensitivity: 150
InvertYControll: -1
fileFormatVersion: 2
guid: eabfc7e8aea3b0440923667d408935ea
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &433199501035556453
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 433199501035556479}
- component: {fileID: 433199501035556478}
- component: {fileID: 433199501035556449}
- component: {fileID: 433199501035556448}
- component: {fileID: 433199501035556450}
m_Layer: 0
m_Name: Player
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &433199501035556479
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 433199501035556453}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.46, y: 1.53, z: -0.39}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &433199501035556478
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 433199501035556453}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &433199501035556449
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 433199501035556453}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!143 &433199501035556448
CharacterController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 433199501035556453}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Height: 2
m_Radius: 0.5
m_SlopeLimit: 45
m_StepOffset: 0.3
m_SkinWidth: 0.08
m_MinMoveDistance: 0.001
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &433199501035556450
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 433199501035556453}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e09e958553310c469a8d76b9c0b6d7d, type: 3}
m_Name:
m_EditorClassIdentifier:
Speed: 10
GravityStrength: 0.5
JumpStrength: 20
fileFormatVersion: 2
guid: 48dc78f0349b1ea4c9525de264dc6864
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ThirdPersonCam : MonoBehaviour
{
public float Distance = 8,
Height = 1,
Sensitivity = 10;
public int InvertYControll = -1;
Transform PlayerTransform; // to follow
float CurrentY,
CurrentX;
private void Start()
//for now does what the network thing will do.
{
Initialize3pCamera(GameObject.FindGameObjectWithTag("Player").transform);
}
void Update()
{
GetInputs();
}
private void LateUpdate()
{
SetCamPosition();
}
void GetInputs()
//fetches input. From Update
{
if (Input.GetKey(KeyCode.CapsLock))
{
CurrentX += Input.GetAxis("Mouse X") * Time.deltaTime * Sensitivity;
CurrentY += (Input.GetAxis("Mouse Y")) * InvertYControll * Time.deltaTime * Sensitivity;
CurrentY = Mathf.Clamp(CurrentY, -85, 85);
}
}
public void Initialize3pCamera(Transform playerTransform)
// Sets up camera
{
PlayerTransform = playerTransform;
//Mouse things
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
void SetCamPosition()
//Moves Camera, From Late Update
{
if (Input.GetKey(KeyCode.CapsLock))
{
Vector3 dir = new Vector3(0, 0, -Distance);
Quaternion rotation = Quaternion.Euler(CurrentY, CurrentX, 0);
Vector3 orbitPosition = (PlayerTransform.position + new Vector3(0, Height, 0)) + rotation * dir;
if (orbitPosition.y < 0.3f) // if camera is too near the floor, stop it from clipping.
{
orbitPosition.y = 0.3f;
}
transform.position = orbitPosition;
transform.LookAt(PlayerTransform.position + new Vector3(0, Height, 0));
}
}
}
fileFormatVersion: 2
guid: 37f2e6545c16a9545bab9e357db06531
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(CharacterController))]
public class ThirdPersonMove : MonoBehaviour
{
public float Speed = 10,
GravityStrength = 0.5f,
JumpStrength = 10f;
CharacterController CharControl;
Transform CamTransform;
Vector2 InputVec;
bool JumpInput = false;
float YSpeed = 0f;
private static float StickingForce = 0.1f;
void Start()
{
CharControl = GetComponent<CharacterController>();
CamTransform = Camera.main.transform;
}
void Update()
{
GetInput();
}
private void FixedUpdate()
{
Vector3 movementVec = CalcFlatMovement();
movementVec.y = CalcYMovement();
CharControl.Move(movementVec);
}
void GetInput()
//fetch Inputs, In update
{
InputVec = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
JumpInput = (Input.GetAxisRaw("Jump") == 1);
}
Vector3 CalcFlatMovement()
//handles camera based directional input
{
Vector3 forwardVec = CamTransform.forward;
forwardVec.y = 0;
forwardVec.Normalize();
Vector3 rightVec = CamTransform.right;
rightVec.y = 0;
rightVec.Normalize();
return (InputVec.x * rightVec + InputVec.y * forwardVec).normalized * Speed * Time.fixedDeltaTime;
}
float CalcYMovement()
//handles gravity, and jumping, called from Fixed Update
{
if (CharControl.isGrounded)
{
if (JumpInput)
{
YSpeed = JumpStrength/ 100;
JumpInput = false;
}
else
{
YSpeed = -StickingForce;
}
return YSpeed;
}
else
{
YSpeed -= GravityStrength * Time.fixedDeltaTime;
return YSpeed;
}
}
}
fileFormatVersion: 2
guid: 4e09e958553310c469a8d76b9c0b6d7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment