Skip to content

Commit

Permalink
Camera added, unwanted script removed
Browse files Browse the repository at this point in the history
  • Loading branch information
snlpatel001213 committed Dec 4, 2021
1 parent 4447dfc commit 3834b3a
Show file tree
Hide file tree
Showing 291 changed files with 65 additions and 16,125 deletions.
28 changes: 16 additions & 12 deletions Assets/AirplanePhysics/Code/Scripts/Cameras/AC_Airplane_Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,30 @@

namespace AirControl
{
public class AC_Airplane_Camera : MonoBehaviour
public class AC_Airplane_Camera : AC_Basic_Follow_Camera
{
#region Variables
[Header("Airplane Camera Properties")]
public float minHeaightFromGround = 8;

#endregion

#region Builtin Methods
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{

}
#endregion

#region Custom Methods
protected override void HandleCamera(){
// Airplane specifc camera
// Ray cast hit the ground
RaycastHit hit;
if(Physics.Raycast(transform.position, Vector3.down, out hit));{
if(hit.distance < minHeaightFromGround && hit.transform.tag == "ground"){
float wantedHeight = originalCamraHeight + (minHeaightFromGround - hit.distance);
cameraHeight = wantedHeight;
}
}
base.HandleCamera();
}
#endregion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,45 @@ namespace AirControl
public class AC_Basic_Follow_Camera : MonoBehaviour
{
#region Variables
[Header("Basic follow camera properties")]
[Tooltip("Drag and drop entire airplane group over here")]
public Transform airplane;
public float cameraDistance = 10f;
public float cameraHeight = 6f;
public float cameraMovementSpeed = 0.5f;

private Vector3 smoothVelocity;

protected float originalCamraHeight;
#endregion

#region Builtin Methods
// Start is called before the first frame update
void Start()
{

originalCamraHeight = cameraHeight;
}

// Update is called once per frame
void Update()
void FixedUpdate()
{
HandleCamera()
if(airplane){
HandleCamera();
}// handel else

}
#endregion

#region Custom Methods
protected virtual void HandleCamera()
{
//Camera that follow the target

// Camera that follow the target
// -airplane.forward*cameraDistance Negative to bring the camera back of the airplane
Vector3 wantedPosition = airplane.position + (-airplane.forward*cameraDistance) + Vector3.up*cameraHeight;
Debug.DrawLine(airplane.position, wantedPosition, Color.blue);
transform.position = Vector3.SmoothDamp(transform.position, wantedPosition, ref smoothVelocity, cameraMovementSpeed);
// Watch the airplane
transform.LookAt(airplane);
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace AirControl
{
public class AC_BaseAirplane_Input : MonoBehaviour
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace AirControl
{
[CustomEditor(typeof(AC_XboxAirplane_Input))]
Expand Down
30 changes: 24 additions & 6 deletions Assets/AirplanePhysics/Scenes/AirplanePhysics_Dev.unity
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ GameObject:
- component: {fileID: 525880060}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_TagString: ground
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand Down Expand Up @@ -268,7 +268,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7e0195a3a636ffa41b6cc396ddae4758, type: 2}
- {fileID: -8274133419916619345, guid: 6be004aed976d39018c5ca4a458a9f64, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
Expand Down Expand Up @@ -637,6 +637,7 @@ GameObject:
- component: {fileID: 1737466728}
- component: {fileID: 1737466727}
- component: {fileID: 1737466726}
- component: {fileID: 1737466729}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -702,13 +703,30 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1737466725}
m_LocalRotation: {x: 0.18158482, y: -0, z: -0, w: 0.98337525}
m_LocalPosition: {x: 0.47, y: 8.79, z: -13.69}
m_LocalRotation: {x: 0.18158484, y: -0, z: -0, w: 0.9833753}
m_LocalPosition: {x: 0.47, y: 10.424, z: -13.69}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6182990085044994289}
m_RootOrder: 4
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 20.924, y: 0, z: 0}
--- !u!114 &1737466729
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1737466725}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cf7aba100789b4ce487fde455121e9a9, type: 3}
m_Name:
m_EditorClassIdentifier:
airplane: {fileID: 6182990085044994289}
cameraDistance: 10
cameraHeight: 6
cameraMovementSpeed: 0.5
minHeaightFromGround: 4
--- !u!1 &1791669347
GameObject:
m_ObjectHideFlags: 0
Expand Down
9 changes: 0 additions & 9 deletions Assets/IndiePixel_Framework/Core.meta

This file was deleted.

9 changes: 0 additions & 9 deletions Assets/IndiePixel_Framework/Core/Art.meta

This file was deleted.

9 changes: 0 additions & 9 deletions Assets/IndiePixel_Framework/Core/Art/Audio.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/IndiePixel_Framework/Core/Art/Audio/UI.meta

This file was deleted.

Binary file not shown.
23 changes: 0 additions & 23 deletions Assets/IndiePixel_Framework/Core/Art/Audio/UI/NavSingle.wav.meta

This file was deleted.

Binary file not shown.
23 changes: 0 additions & 23 deletions Assets/IndiePixel_Framework/Core/Art/Audio/UI/Select.wav.meta

This file was deleted.

9 changes: 0 additions & 9 deletions Assets/IndiePixel_Framework/Core/Art/Grids.meta

This file was deleted.

78 changes: 0 additions & 78 deletions Assets/IndiePixel_Framework/Core/Art/Grids/Orange_Grid_MAT.mat

This file was deleted.

This file was deleted.

Binary file not shown.
Loading

0 comments on commit 3834b3a

Please sign in to comment.