diff --git a/Guide_RU.mat b/Guide_RU.mat index 420f9d1a..b3cd75ec 100644 --- a/Guide_RU.mat +++ b/Guide_RU.mat @@ -40,7 +40,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 52e355960b4a0d242b120fd53f7fe426, type: 3} + m_Texture: {fileID: 2800000, guid: 4d189d8105a3ac443b699086ea5e0286, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MetallicGlossMap: diff --git a/Other/MultiObjectToggle.cs b/Other/MultiObjectToggle.cs new file mode 100644 index 00000000..3e0a13f5 --- /dev/null +++ b/Other/MultiObjectToggle.cs @@ -0,0 +1,32 @@ + +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + +public class MultiObjectToggle : UdonSharpBehaviour +{ + private int current = 0; + public GameObject[] ToggleObjs; + private void Interact()//entering the plane + { + current++; + if (current == ToggleObjs.Length) + { + current = 0; + } + int o = 0; + foreach (GameObject obj in ToggleObjs) + { + if (o != current) + { + obj.SetActive(false); + } + else + { + obj.SetActive(true); + } + o++; + } + } +} diff --git a/SF-1/Scripts/AAMController.cs b/SF-1/Scripts/AAMController.cs index 9c06c1f7..e569a53c 100644 --- a/SF-1/Scripts/AAMController.cs +++ b/SF-1/Scripts/AAMController.cs @@ -55,6 +55,7 @@ void Start() } void LateUpdate() { + float DeltaTime = Time.deltaTime; //Debug.Log(gameObject.GetComponent().velocity.magnitude); if (!ColliderActive) { @@ -81,11 +82,7 @@ void LateUpdate() } else Explode();//explode and give Lifetime another 10 seconds } - } - private void FixedUpdate() - { - float DeltaTime = Time.deltaTime; Vector3 Position = transform.position; Vector3 TargetPos = Target.position; float TargetDistance = Vector3.Distance(Position, TargetPos); @@ -119,7 +116,6 @@ private void FixedUpdate() TargDistlastframe = TargetDistance; Lifetime += DeltaTime; } - private void OnCollisionEnter(Collision other) { if (!Exploding) diff --git a/SF-1/Scripts/EngineController.cs b/SF-1/Scripts/EngineController.cs index 36259765..33988e2e 100644 --- a/SF-1/Scripts/EngineController.cs +++ b/SF-1/Scripts/EngineController.cs @@ -307,6 +307,7 @@ public class EngineController : UdonSharpBehaviour private float FullAGMsDivider; private float FullBombsDivider; private bool CanopyOpenCheck = true; + private Quaternion AGMCamLastFrame; //float MouseX; //float MouseY; //float mouseysens = 1; //mouse input can't be used because it's used to look around even when in a seat @@ -434,9 +435,6 @@ private void Start() ReversingYawStrengthZero = YawThrustVecMulti == 0 ? -ReversingYawStrengthMulti : 1; ReversingRollStrengthZero = RollThrustVecMulti == 0 ? -ReversingRollStrengthMulti : 1; - if (AAMTargets[AAMTarget] != null && AAMTargets[AAMTarget].transform.parent != null) - AAMCurrentTargetEngineControl = AAMTargets[AAMTarget].transform.parent.GetComponent(); - FullAAMsDivider = 1f / NumAAM; FullAGMsDivider = 1f / NumAGM; FullBombsDivider = 1f / NumBomb; @@ -1244,30 +1242,33 @@ private void LateUpdate() //AGM Camera, more in hudcontroller if (!AGMLocked) { - Quaternion temp = Quaternion.identity; + Quaternion newangle; if (InVR) { - temp = localPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.RightHand).rotation * Quaternion.Euler(0, 60, 0); + newangle = localPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.RightHand).rotation * Quaternion.Euler(0, 60, 0); } else if (!InEditor)//desktop mode { - temp = localPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).rotation; + newangle = localPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).rotation; } else//editor { - temp = VehicleMainObj.transform.rotation; + newangle = VehicleMainObj.transform.rotation; } - AGMCamRotSlerper = Quaternion.Slerp(AGMCamRotSlerper, temp, 70f * DeltaTime); + float ZoomLevel = AtGCam.fieldOfView / 90; + AGMCamRotSlerper = Quaternion.Slerp(AGMCamRotSlerper, newangle, ZoomLevel * 70f * DeltaTime); if (AtGCam != null) { - AGMRotDif = Vector3.Angle(AtGCam.transform.rotation * Vector3.forward, AGMCamRotSlerper * Vector3.forward); + AGMRotDif = Vector3.Angle(AtGCam.transform.rotation * Vector3.forward, AGMCamLastFrame * Vector3.forward); + // AGMRotDif = Vector3.Angle(AtGCam.transform.rotation * Vector3.forward, AGMCamRotSlerper * Vector3.forward); AtGCam.transform.rotation = AGMCamRotSlerper; - //dunno if there's a better way to do this + Vector3 temp2 = AtGCam.transform.localRotation.eulerAngles; temp2.z = 0; AtGCam.transform.localRotation = Quaternion.Euler(temp2); } + AGMCamLastFrame = newangle; } @@ -1603,7 +1604,19 @@ private void LateUpdate() } else//if cruise control disabled, use inputs { - ThrottleInput = PlayerThrottle; + if (!InVR) + { + if (LTrigger > .07f) + ThrottleInput = LTrigger; + else + { + ThrottleInput = PlayerThrottle; + } + } + else + { + ThrottleInput = PlayerThrottle; + } } Fuel = Mathf.Clamp(Fuel - ((FuelConsumption * Mathf.Max(ThrottleInput, 0.35f)) * DeltaTime), 0, FullFuel); if (Fuel < 200) ThrottleInput = Mathf.Clamp(ThrottleInput * (Fuel / 200), 0, 1); @@ -1666,6 +1679,7 @@ private void LateUpdate() { if (!InVR) { + //allow stick flight with gamepads VRPitchRollInput = LStick; JoystickPosYaw.x = RStick.x; //make stick input square @@ -1754,14 +1768,6 @@ private void LateUpdate() } else VehicleRigidbody.velocity = Vector3.zero; } - PilotingInt = 0; - roll = 0; - pitch = 0; - yaw = 0; - RollInput = 0; - PitchInput = 0; - YawInput = 0; - ThrottleInput = 0; /* PitchInput = Trim.x; YawInput = Trim.y; */ } @@ -2207,6 +2213,7 @@ private void AAMTargeting(float Lock_Angle) Vector3 AAMNextTargetDirection = (TargetCheckerTransform.position - CenterOfMass.transform.position); float NextTargetAngle = Vector3.Angle(VehicleMainObj.transform.forward, AAMNextTargetDirection); float NextTargetDistance = Vector3.Distance(CenterOfMass.position, TargetCheckerTransform.position); + bool AAMCurrentTargetEngineControlNull = AAMCurrentTargetEngineControl == null ? true : false; if (TargetChecker.activeInHierarchy) { @@ -2221,13 +2228,14 @@ private void AAMTargeting(float Lock_Angle) { RaycastHit hitnext; //raycast to check if it's behind something - Physics.Raycast(HUDControl.transform.position, AAMNextTargetDirection, out hitnext, Mathf.Infinity, 133121 /* Default, Environment, and Walkthrough */, QueryTriggerInteraction.Ignore); + bool LineOfSightNext = Physics.Raycast(HUDControl.transform.position, AAMNextTargetDirection, out hitnext, Mathf.Infinity, 133121 /* Default, Environment, and Walkthrough */, QueryTriggerInteraction.Ignore); - if (hitnext.point != null + if ((LineOfSightNext && hitnext.collider.gameObject.layer == OutsidePlaneLayer && NextTargetAngle < Lock_Angle && NextTargetDistance < AAMMaxTargetDistance && NextTargetAngle < AAMCurrentTargetAngle) + || (!AAMCurrentTargetEngineControlNull && AAMCurrentTargetEngineControl.Taxiing)) //prevent being unable to target next target if it's angle is higher than your current target and your current target happens to be taxiing and is therefore untargetable { //found new target AAMCurrentTargetAngle = NextTargetAngle; @@ -2236,6 +2244,7 @@ private void AAMTargeting(float Lock_Angle) AAMCurrentTargetEngineControl = NextTargetEngineControl; AAMLockTimer = 0; AAMTargetedTimer = .6f;//give the synced variable time to update before sending targeted + AAMCurrentTargetEngineControlNull = AAMCurrentTargetEngineControl == null ? true : false; if (HUDControl != null) { HUDControl.GUN_TargetSpeedLerper = 0f; @@ -2254,7 +2263,7 @@ private void AAMTargeting(float Lock_Angle) AAMTargetChecker = 0; //if target is currently in front of plane, lock onto it - if (AAMCurrentTargetEngineControl == null) + if (AAMCurrentTargetEngineControlNull) { AAMCurrentTargetDirection = AAMCurrentTargetPosition - HUDControl.transform.position; } else { AAMCurrentTargetDirection = AAMCurrentTargetEngineControl.CenterOfMass.position - HUDControl.transform.position; } @@ -2262,16 +2271,16 @@ private void AAMTargeting(float Lock_Angle) //check if target is active, and if it's enginecontroller is null(dummy target), or if it's not null(plane) make sure it's not taxiing or dead. //raycast to check if it's behind something RaycastHit hitcurrent; - Physics.Raycast(HUDControl.transform.position, AAMCurrentTargetDirection, out hitcurrent, Mathf.Infinity, 133121 /* Default, Environment, and Walkthrough */, QueryTriggerInteraction.Ignore); + bool LineOfSightCur = Physics.Raycast(HUDControl.transform.position, AAMCurrentTargetDirection, out hitcurrent, Mathf.Infinity, 133121 /* Default, Environment, and Walkthrough */, QueryTriggerInteraction.Ignore); //used to make lock remain for .25 seconds after target is obscured - if (hitcurrent.point == null || hitcurrent.collider.gameObject.layer != OutsidePlaneLayer) + if (LineOfSightCur == false || hitcurrent.collider.gameObject.layer != OutsidePlaneLayer) { AAMTargetObscuredDelay += DeltaTime; } else { AAMTargetObscuredDelay = 0; } if (!Taxiing && AAMTargets[AAMTarget].activeInHierarchy - && (AAMCurrentTargetEngineControl == null || (!AAMCurrentTargetEngineControl.Taxiing && !AAMCurrentTargetEngineControl.dead))) + && (AAMCurrentTargetEngineControlNull || (!AAMCurrentTargetEngineControl.Taxiing && !AAMCurrentTargetEngineControl.dead))) { if ((AAMTargetObscuredDelay < .25f) && AAMCurrentTargetAngle < Lock_Angle @@ -2280,7 +2289,7 @@ private void AAMTargeting(float Lock_Angle) AAMHasTarget = true; if (NumAAM > 0) AAMLockTimer += DeltaTime; //give enemy radar lock even if you're out of missiles - if (AAMCurrentTargetEngineControl != null && RStickSelection == 2) + if (!AAMCurrentTargetEngineControlNull && RStickSelection == 2) { //target is a plane AAMTargetedTimer += DeltaTime; @@ -2554,6 +2563,17 @@ public void ToggleLimits() } } } + public void ZeroControlValues() + { + PilotingInt = 0; + roll = 0; + pitch = 0; + yaw = 0; + RollInput = 0; + PitchInput = 0; + YawInput = 0; + ThrottleInput = 0; + } private void Assert(bool condition, string message) { if (!condition) diff --git a/SF-1/Scripts/HUDController.cs b/SF-1/Scripts/HUDController.cs index 1e80e4e2..2b589bb6 100644 --- a/SF-1/Scripts/HUDController.cs +++ b/SF-1/Scripts/HUDController.cs @@ -376,22 +376,21 @@ private void LateUpdate() { AtGScreen.SetActive(true); EngineControl.AtGCam.gameObject.SetActive(true); - float newzoom = 0; //if turning camera fast, zoom out - if (EngineControl.AGMRotDif < .8f) + if (EngineControl.AGMRotDif < .13f) { RaycastHit camhit; Physics.Raycast(EngineControl.AtGCam.transform.position, EngineControl.AtGCam.transform.forward, out camhit, Mathf.Infinity, 1); if (camhit.point != null) { //dolly zoom //Mathf.Atan(100 <--the 100 is the height of the camera frustrum at the target distance - newzoom = Mathf.Clamp(2.0f * Mathf.Atan(100 * 0.5f / Vector3.Distance(gameObject.transform.position, camhit.point)) * Mathf.Rad2Deg, 1.5f, 90); + float newzoom = Mathf.Clamp(2.0f * Mathf.Atan(100 * 0.5f / Vector3.Distance(gameObject.transform.position, camhit.point)) * Mathf.Rad2Deg, 1.5f, 90); EngineControl.AtGCam.fieldOfView = Mathf.Clamp(Mathf.Lerp(EngineControl.AtGCam.fieldOfView, newzoom, 1.5f * DeltaTime), 0.3f, 90); } } else { - newzoom = 80; + float newzoom = 80; EngineControl.AtGCam.fieldOfView = Mathf.Clamp(Mathf.Lerp(EngineControl.AtGCam.fieldOfView, newzoom, 3.5f * DeltaTime), 0.3f, 90); //zooming in is a bit slower than zooming out } } diff --git a/SF-1/Scripts/PilotSeat.cs b/SF-1/Scripts/PilotSeat.cs index f4fe2463..f8d61845 100644 --- a/SF-1/Scripts/PilotSeat.cs +++ b/SF-1/Scripts/PilotSeat.cs @@ -143,7 +143,7 @@ public override void OnStationExited(VRCPlayerApi player) EngineControl.localPlayer.SetVelocity(EngineControl.CurrentVel + EngineControl.VehicleMainObj.transform.up * 25); EngineControl.Ejected = false; } - else EngineControl.localPlayer.SetVelocity(EngineControl.CurrentVel); + else { EngineControl.localPlayer.SetVelocity(EngineControl.CurrentVel); } EngineControl.EjectTimer = 2; EngineControl.Hooked = false; EngineControl.BrakeInput = 0; @@ -165,6 +165,7 @@ public override void OnStationExited(VRCPlayerApi player) EngineControl.EffectsControl.PlaneAnimator.SetInteger("missilesincoming", 0); EngineControl.AAMLockTimer = 0; EngineControl.AAMLocked = false; + EngineControl.ZeroControlValues(); if (EngineControl.CatapultStatus == 1) { EngineControl.CatapultStatus = 0; }//keep launching if launching, otherwise unlock from catapult if (LeaveButton != null) { LeaveButton.SetActive(false); } diff --git a/Textures/Guide_RU.png b/Textures/Guide_RU.png index 6a897653..f8a0a0e8 100644 Binary files a/Textures/Guide_RU.png and b/Textures/Guide_RU.png differ diff --git a/Udon/EngineController.asset b/Udon/EngineController.asset index fb6f855f..76beb84f 100644 --- a/Udon/EngineController.asset +++ b/Udon/EngineController.asset @@ -47,7 +47,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 281 + Data: 282 - Name: Entry: 7 Data: @@ -16767,6 +16767,63 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: AGMCamLastFrame + - Name: $v + Entry: 7 + Data: 962|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 963|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 9 + Data: 473 + - Name: declarationType + Entry: 3 + Data: 2 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: UnityEngineQuaternion + - Name: symbolOriginalName + Entry: 1 + Data: AGMCamLastFrame + - Name: symbolUniqueName + Entry: 1 + Data: AGMCamLastFrame + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 964|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: - Name: Entry: 13 Data: diff --git a/Udon/MultiObjectToggle.asset b/Udon/MultiObjectToggle.asset new file mode 100644 index 00000000..988eee20 --- /dev/null +++ b/Udon/MultiObjectToggle.asset @@ -0,0 +1,177 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: MultiObjectToggle + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 4df92f6356511024eb204148cebe79ee, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: b47eaf257ba12fe49b66b9f1d90c4eaf, type: 3} + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 1 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: current + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 3|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 4|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 2 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemInt32 + - Name: symbolOriginalName + Entry: 1 + Data: current + - Name: symbolUniqueName + Entry: 1 + Data: current + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: ToggleObjs + - Name: $v + Entry: 7 + Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 7|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 8|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.GameObject[], UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: UnityEngineGameObjectArray + - Name: symbolOriginalName + Entry: 1 + Data: ToggleObjs + - Name: symbolUniqueName + Entry: 1 + Data: ToggleObjs + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: