fixed camera rotation issues'

This commit is contained in:
cyndrdev 2021-03-02 18:28:13 +00:00
parent 368b03f848
commit 1d8eff8015
3 changed files with 19 additions and 92 deletions

View File

@ -203,9 +203,9 @@ MonoBehaviour:
m_ActionName: CoreMap/Move[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d,/XInputControllerWindows/leftStick] m_ActionName: CoreMap/Move[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d,/XInputControllerWindows/leftStick]
- m_PersistentCalls: - m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 13726836969441782} - m_Target: {fileID: 11500000, guid: f1cbb1d5d2a7715478647c26d4e71482, type: 3}
m_TargetAssemblyTypeName: PlayerInputHandler, Assembly-CSharp m_TargetAssemblyTypeName: FreeLookAddOn, Assembly-CSharp
m_MethodName: Look m_MethodName:
m_Mode: 0 m_Mode: 0
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
@ -284,6 +284,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2} _nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
_inputSettings: {fileID: 11400000, guid: 09b165d6ce14f86459be7213da9688a7, type: 2} _inputSettings: {fileID: 11400000, guid: 09b165d6ce14f86459be7213da9688a7, type: 2}
_camera: {fileID: 0}
--- !u!114 &13726837176080779 --- !u!114 &13726837176080779
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -409,7 +410,7 @@ GameObject:
- component: {fileID: 420649584177745496} - component: {fileID: 420649584177745496}
- component: {fileID: 8195219718842661232} - component: {fileID: 8195219718842661232}
m_Layer: 0 m_Layer: 0
m_Name: Sphere m_Name: FollowTarget
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0

View File

@ -505,7 +505,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 827761301} m_GameObject: {fileID: 827761301}
m_LocalRotation: {x: 0.12082611, y: 1.7763568e-15, z: -1.6069556e-21, w: 0.9926737} m_LocalRotation: {x: 0.12082611, y: -3.7677753e-15, z: 1.0303356e-15, w: 0.9926737}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
@ -673,7 +673,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1031434356} m_GameObject: {fileID: 1031434356}
m_LocalRotation: {x: 0.120692424, y: 0.046688613, z: -0.005682839, w: 0.9915751} m_LocalRotation: {x: 0.12069755, y: 0.045786913, z: -0.005573086, w: 0.9916172}
m_LocalPosition: {x: 0, y: 0.110000014, z: -3.7200003} m_LocalPosition: {x: 0, y: 0.110000014, z: -3.7200003}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
@ -1015,8 +1015,8 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1325377636} m_GameObject: {fileID: 1325377636}
m_LocalRotation: {x: 0.12082521, y: -0.00000002848674, z: 0.0000000034673187, w: 0.9926738} m_LocalRotation: {x: 0.12082608, y: 0.000000030494466, z: -0.00000000371172, w: 0.9926737}
m_LocalPosition: {x: 0, y: -0.0000059604645, z: 0.0000009536743} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 2023640839} - {fileID: 2023640839}
@ -1094,7 +1094,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363578753} m_GameObject: {fileID: 1363578753}
m_LocalRotation: {x: 0.120692395, y: 0.046688605, z: -0.005682837, w: 0.9915751} m_LocalRotation: {x: 0.12069752, y: 0.04578691, z: -0.005573085, w: 0.9916172}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
@ -2003,93 +2003,13 @@ PrefabInstance:
propertyPath: m_Camera propertyPath: m_Camera
value: value:
objectReference: {fileID: 1031434360} objectReference: {fileID: 1031434360}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[1].m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 11500000, guid: f1cbb1d5d2a7715478647c26d4e71482, type: 3}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[1].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value:
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[1].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: FreeLookAddOn, Assembly-CSharp
objectReference: {fileID: 0}
- target: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} - target: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Player value: Player
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} - target: {fileID: 13726836969441782, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _cheatBlink propertyPath: _camera
value: 1
objectReference: {fileID: 0}
- target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _cheatBoost
value: 1
objectReference: {fileID: 0}
- target: {fileID: 13726837293638817, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _settings
value: value:
objectReference: {fileID: 11400000, guid: 995f378ab762cd344b7a6d108f049191, type: 2} objectReference: {fileID: 1031434360}
- target: {fileID: 13726837293638817, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 13726837293638818, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 13726837293638818, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: field of view
value: 50
objectReference: {fileID: 0}
- target: {fileID: 13726837293638818, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: far clip plane
value: 5000
objectReference: {fileID: 0}
- target: {fileID: 13726837293638818, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: near clip plane
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 13726837293638830, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_LocalPosition.y
value: 1.8
objectReference: {fileID: 0}
- target: {fileID: 13726837293638830, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_LocalPosition.z
value: -3
objectReference: {fileID: 0}
- target: {fileID: 13726837293638830, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9955012
objectReference: {fileID: 0}
- target: {fileID: 13726837293638830, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_LocalRotation.x
value: 0.0800918
objectReference: {fileID: 0}
- target: {fileID: 13726837293638830, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_LocalRotation.y
value: 0.05045944
objectReference: {fileID: 0}
- target: {fileID: 13726837293638830, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_LocalRotation.z
value: -0.0040596505
objectReference: {fileID: 0}
- target: {fileID: 13726837293638831, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1703779518772407877, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Name
value: FollowTarget
objectReference: {fileID: 0}
- target: {fileID: 9057303937983535475, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9057303937983535475, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: ListenerNumber
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}

View File

@ -13,6 +13,9 @@ public class PlayerInputHandler : MonoBehaviour
[SerializeField] [SerializeField]
private PlayerInputSettings _inputSettings; private PlayerInputSettings _inputSettings;
[SerializeField]
private Camera _camera;
public class PlayerInputState public class PlayerInputState
{ {
public BufferedInput Jump; public BufferedInput Jump;
@ -55,6 +58,9 @@ public class PlayerInputHandler : MonoBehaviour
private void FixedUpdate() private void FixedUpdate()
{ {
_state.Update( Time.fixedDeltaTime ); _state.Update( Time.fixedDeltaTime );
float cameraRotation = _camera.transform.rotation.eulerAngles.y;
_state.Move.SetAngle(-cameraRotation);
} }
public void SetCameraRotation(float angle) public void SetCameraRotation(float angle)