├── .gitattributes ├── .gitignore ├── Assets ├── New Terrain.asset ├── New Terrain.asset.meta ├── Sample Scene.unity ├── Sample Scene.unity.meta ├── Standard Assets.meta ├── Standard Assets │ ├── Cameras.meta │ ├── Cameras │ │ ├── CameraGuidelines.txt │ │ ├── CameraGuidelines.txt.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── AbstractTargetFollower.cs │ │ │ ├── AbstractTargetFollower.cs.meta │ │ │ ├── AutoCam.cs │ │ │ ├── AutoCam.cs.meta │ │ │ ├── FreeLookCam.cs │ │ │ ├── FreeLookCam.cs.meta │ │ │ ├── HandHeldCam.cs │ │ │ ├── HandHeldCam.cs.meta │ │ │ ├── LookatTarget.cs │ │ │ ├── LookatTarget.cs.meta │ │ │ ├── PivotBasedCameraRig.cs │ │ │ ├── PivotBasedCameraRig.cs.meta │ │ │ ├── ProtectCameraFromWallClip.cs │ │ │ ├── ProtectCameraFromWallClip.cs.meta │ │ │ ├── TargetFieldOfView.cs │ │ │ └── TargetFieldOfView.cs.meta │ ├── SampleScenes.meta │ ├── SampleScenes │ │ ├── Materials.meta │ │ ├── Materials │ │ │ ├── NavyDarkGrid.mat │ │ │ ├── NavyDarkGrid.mat.meta │ │ │ ├── NavyDarkSmooth.mat │ │ │ ├── NavyDarkSmooth.mat.meta │ │ │ ├── NavyGrid.mat │ │ │ ├── NavyGrid.mat.meta │ │ │ ├── NavySmooth.mat │ │ │ ├── NavySmooth.mat.meta │ │ │ ├── WhiteSmooth.mat │ │ │ └── WhiteSmooth.mat.meta │ │ ├── Models.meta │ │ ├── Models │ │ │ ├── GroundObstacles.FBX │ │ │ ├── GroundObstacles.FBX.meta │ │ │ ├── GroundTrack.fbx │ │ │ ├── GroundTrack.fbx.meta │ │ │ ├── MiniRamps.fbx │ │ │ ├── MiniRamps.fbx.meta │ │ │ ├── Platform.fbx │ │ │ ├── Platform.fbx.meta │ │ │ ├── PrimaryJumpRamp.fbx │ │ │ └── PrimaryJumpRamp.fbx.meta │ │ ├── Textures.meta │ │ └── Textures │ │ │ ├── GridEmissive.png │ │ │ ├── GridEmissive.png.meta │ │ │ ├── SwatchNavyAlbedo.png │ │ │ ├── SwatchNavyAlbedo.png.meta │ │ │ ├── SwatchNavyDarkAlbedo.png │ │ │ └── SwatchNavyDarkAlbedo.png.meta │ ├── Vehicles.meta │ └── Vehicles │ │ ├── Car.meta │ │ └── Car │ │ ├── CarGuidelines.txt │ │ ├── CarGuidelines.txt.meta │ │ ├── Materials.meta │ │ ├── Materials │ │ ├── SkyCarBodyGrey.mat │ │ └── SkyCarBodyGrey.mat.meta │ │ ├── Models.meta │ │ ├── Models │ │ ├── Materials.meta │ │ ├── Materials │ │ │ ├── SkyCarBodyWhite.mat │ │ │ ├── SkyCarBodyWhite.mat.meta │ │ │ ├── SkyCarLightCoversWhite.mat │ │ │ ├── SkyCarLightCoversWhite.mat.meta │ │ │ ├── SkyCarLightGlows.mat │ │ │ ├── SkyCarLightGlows.mat.meta │ │ │ ├── SkyCarWheelWhite.mat │ │ │ └── SkyCarWheelWhite.mat.meta │ │ ├── SkyCar.fbx │ │ └── SkyCar.fbx.meta │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── CarController.cs │ │ ├── CarController.cs.meta │ │ ├── CarSelfRighting.cs │ │ ├── CarSelfRighting.cs.meta │ │ ├── CarUserControl.cs │ │ ├── CarUserControl.cs.meta │ │ ├── Mudguard.cs │ │ ├── Mudguard.cs.meta │ │ ├── Suspension.cs │ │ └── Suspension.cs.meta │ │ ├── Textures.meta │ │ └── Textures │ │ ├── SkyCarBodyNormals.png │ │ ├── SkyCarBodyNormals.png.meta │ │ ├── SkyCarBodyOcclusion.png │ │ ├── SkyCarBodyOcclusion.png.meta │ │ ├── SkyCarLightsGlowAlpha.png │ │ ├── SkyCarLightsGlowAlpha.png.meta │ │ ├── SkyCarWheelNormals.png │ │ ├── SkyCarWheelNormals.png.meta │ │ ├── SkyCarWheelOcclusion.png │ │ └── SkyCarWheelOcclusion.png.meta ├── UnitySkidmarks.meta ├── UnitySkidmarks │ ├── Skidmarks.cs │ ├── Skidmarks.cs.meta │ ├── Skidmarks.shader │ ├── Skidmarks.shader.meta │ ├── SkidmarksMat.mat │ ├── SkidmarksMat.mat.meta │ ├── SkidmarksTex.psd │ ├── SkidmarksTex.psd.meta │ ├── WheelSkid.cs │ └── WheelSkid.cs.meta ├── csc.rsp └── csc.rsp.meta ├── LICENCE ├── Logs └── Packages-Update.log ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset ├── README.md └── skid.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | /[Ll]ibrary/ 3 | /[Tt]emp/ 4 | /[Oo]bj/ 5 | *.sln 6 | UnitySkidmarks.Plugins.csproj 7 | *.csproj 8 | /.vs/ -------------------------------------------------------------------------------- /Assets/New Terrain.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/New Terrain.asset -------------------------------------------------------------------------------- /Assets/New Terrain.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be520d63b32664f42a09ddc5b75e4793 3 | timeCreated: 1494413922 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 15600000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Sample Scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Sample Scene.unity -------------------------------------------------------------------------------- /Assets/Sample Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41b8fdb98491fab48a0cd641d4c0e3b1 3 | DefaultImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6195a43a0187a34e9c6be23520d3766 3 | folderAsset: yes 4 | timeCreated: 1436977287 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 604bd9e7358cf48c0969f5b515a8c51c 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/CameraGuidelines.txt: -------------------------------------------------------------------------------- 1 | 2 | In the Camera Prefabs folder are a few Camera Rigs, explained below. 3 | 4 | To use them, simply drop one into your scene, and set the target field on the root of the camera rig. 5 | 6 | If your player is tagged "Player", you don't even have to assign the target, as by default the cameras will automatically target the first object they find tagged "Player". You can uncheck this option if you don't want it. 7 | 8 | After adding one to your scene, you will also probably want to delete the default "Main Camera" that was in your scene already, since the camera rigs contain their own cameras. 9 | 10 | The "Free Look" camera is designed to follow a target's position, while allowing the user to rotate the angle of the camera with the mouse (or a touch gesture). 11 | 12 | The "Multipurpose" camera is designed to follow a target's position and rotation (or direction of movement) and is useful for many game situations. 13 | 14 | With the "Free Look" and "Multipurpose" camera, the rig is designed so the root object of the rig should always move towards the target's position. The camera offset is specified by the height (the Y value) of the "Pivot" object, and the forward offset of the final "Camera" object. 15 | 16 | A typical set up for this would be to have the Y positional value of the Pivot set to 2 (for 2 meters above the target), and the Z positional value of the Camera set to -6 (for 6 meters behind the pivot). 17 | 18 | If you wanted to adjust the camera to be to one side of the target (eg, for a closer over-shoulder third person view), you should adjust the X position value of the Pivot object. 19 | 20 | Camera Rig <- position will move towards target. 21 | Pivot <- adjust Y position for height, X position for horizontal offset 22 | Camera <- adjust Z position for distance away from target 23 | 24 | 25 | Both the "Free Look" and the "Multipurpose" camera also use the ProtectCameraFromWallClip script, which is intended to stop the camera from passing through items of scenery, as can happen if a character or vehicle targeted by the camera is backed up against a wall. 26 | 27 | The ProtectCameraFromWallClip script examines the distance between the Pivot and the Camera, and attempts to preserve this where possible, but draws the camera in closer to the pivot when colliders are detected. For this reason, if you're using the wall clip script, you can't modify the local offset of the Camera at runtime, because it's being set every frame by the clip protection script. 28 | 29 | The "CCTV Camera" is a little different, being a single GameObject with no hierarchy. Since it doesn't move to follow a target (it only rotates), it doesn't need the wall clip script. Assigning the target works exactly the same as the other Cameras however, and it will also auto target any object tagged "player" unless told otherwise. 30 | 31 | The CCTV camera uses the "LookAtTarget" script, which provides functionality above and beyond Unity's basic "Transform.LookAt" function. It works in local space relative to the object's parent, and allows constraints on the look angle which work relative to the object's starting rotation. Possible uses could be: A view out of the side window of a moving car, A turret which should aim at a target from a moving spaceship, or - as it's used in this case - a CCTV camera which can be placed anywhere and can pan towards a target. 32 | 33 | 34 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/CameraGuidelines.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86f4276d9602ff547968823666aa5699 3 | TextScriptImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7b22774d57de9f4eb961b3ff68ed80a 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/AbstractTargetFollower.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Cameras 5 | { 6 | public abstract class AbstractTargetFollower : MonoBehaviour 7 | { 8 | public enum UpdateType // The available methods of updating are: 9 | { 10 | FixedUpdate, // Update in FixedUpdate (for tracking rigidbodies). 11 | LateUpdate, // Update in LateUpdate. (for tracking objects that are moved in Update) 12 | ManualUpdate, // user must call to update camera 13 | } 14 | 15 | [SerializeField] protected Transform m_Target; // The target object to follow 16 | [SerializeField] private bool m_AutoTargetPlayer = true; // Whether the rig should automatically target the player. 17 | [SerializeField] private UpdateType m_UpdateType; // stores the selected update type 18 | 19 | protected Rigidbody targetRigidbody; 20 | 21 | 22 | protected virtual void Start() 23 | { 24 | // if auto targeting is used, find the object tagged "Player" 25 | // any class inheriting from this should call base.Start() to perform this action! 26 | if (m_AutoTargetPlayer) 27 | { 28 | FindAndTargetPlayer(); 29 | } 30 | if (m_Target == null) return; 31 | targetRigidbody = m_Target.GetComponent(); 32 | } 33 | 34 | 35 | private void FixedUpdate() 36 | { 37 | // we update from here if updatetype is set to Fixed, or in auto mode, 38 | // if the target has a rigidbody, and isn't kinematic. 39 | if (m_AutoTargetPlayer && (m_Target == null || !m_Target.gameObject.activeSelf)) 40 | { 41 | FindAndTargetPlayer(); 42 | } 43 | if (m_UpdateType == UpdateType.FixedUpdate) 44 | { 45 | FollowTarget(Time.deltaTime); 46 | } 47 | } 48 | 49 | 50 | private void LateUpdate() 51 | { 52 | // we update from here if updatetype is set to Late, or in auto mode, 53 | // if the target does not have a rigidbody, or - does have a rigidbody but is set to kinematic. 54 | if (m_AutoTargetPlayer && (m_Target == null || !m_Target.gameObject.activeSelf)) 55 | { 56 | FindAndTargetPlayer(); 57 | } 58 | if (m_UpdateType == UpdateType.LateUpdate) 59 | { 60 | FollowTarget(Time.deltaTime); 61 | } 62 | } 63 | 64 | 65 | public void ManualUpdate() 66 | { 67 | // we update from here if updatetype is set to Late, or in auto mode, 68 | // if the target does not have a rigidbody, or - does have a rigidbody but is set to kinematic. 69 | if (m_AutoTargetPlayer && (m_Target == null || !m_Target.gameObject.activeSelf)) 70 | { 71 | FindAndTargetPlayer(); 72 | } 73 | if (m_UpdateType == UpdateType.ManualUpdate) 74 | { 75 | FollowTarget(Time.deltaTime); 76 | } 77 | } 78 | 79 | protected abstract void FollowTarget(float deltaTime); 80 | 81 | 82 | public void FindAndTargetPlayer() 83 | { 84 | // auto target an object tagged player, if no target has been assigned 85 | var targetObj = GameObject.FindGameObjectWithTag("Player"); 86 | if (targetObj) 87 | { 88 | SetTarget(targetObj.transform); 89 | } 90 | } 91 | 92 | 93 | public virtual void SetTarget(Transform newTransform) 94 | { 95 | m_Target = newTransform; 96 | } 97 | 98 | 99 | public Transform Target 100 | { 101 | get { return m_Target; } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/AbstractTargetFollower.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89a534d869bfccd49bebf7cb6fb244b6 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/AutoCam.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | #if UNITY_EDITOR 4 | 5 | #endif 6 | 7 | namespace UnityStandardAssets.Cameras 8 | { 9 | [ExecuteInEditMode] 10 | public class AutoCam : PivotBasedCameraRig 11 | { 12 | [SerializeField] private float m_MoveSpeed = 3; // How fast the rig will move to keep up with target's position 13 | [SerializeField] private float m_TurnSpeed = 1; // How fast the rig will turn to keep up with target's rotation 14 | [SerializeField] private float m_RollSpeed = 0.2f;// How fast the rig will roll (around Z axis) to match target's roll. 15 | [SerializeField] private bool m_FollowVelocity = false;// Whether the rig will rotate in the direction of the target's velocity. 16 | [SerializeField] private bool m_FollowTilt = true; // Whether the rig will tilt (around X axis) with the target. 17 | [SerializeField] private float m_SpinTurnLimit = 90;// The threshold beyond which the camera stops following the target's rotation. (used in situations where a car spins out, for example) 18 | [SerializeField] private float m_TargetVelocityLowerLimit = 4f;// the minimum velocity above which the camera turns towards the object's velocity. Below this we use the object's forward direction. 19 | [SerializeField] private float m_SmoothTurnTime = 0.2f; // the smoothing for the camera's rotation 20 | 21 | private float m_LastFlatAngle; // The relative angle of the target and the rig from the previous frame. 22 | private float m_CurrentTurnAmount; // How much to turn the camera 23 | private float m_TurnSpeedVelocityChange; // The change in the turn speed velocity 24 | private Vector3 m_RollUp = Vector3.up;// The roll of the camera around the z axis ( generally this will always just be up ) 25 | 26 | 27 | protected override void FollowTarget(float deltaTime) 28 | { 29 | // if no target, or no time passed then we quit early, as there is nothing to do 30 | if (!(deltaTime > 0) || m_Target == null) 31 | { 32 | return; 33 | } 34 | 35 | // initialise some vars, we'll be modifying these in a moment 36 | var targetForward = m_Target.forward; 37 | var targetUp = m_Target.up; 38 | 39 | if (m_FollowVelocity && Application.isPlaying) 40 | { 41 | // in follow velocity mode, the camera's rotation is aligned towards the object's velocity direction 42 | // but only if the object is traveling faster than a given threshold. 43 | 44 | if (targetRigidbody.velocity.magnitude > m_TargetVelocityLowerLimit) 45 | { 46 | // velocity is high enough, so we'll use the target's velocty 47 | targetForward = targetRigidbody.velocity.normalized; 48 | targetUp = Vector3.up; 49 | } 50 | else 51 | { 52 | targetUp = Vector3.up; 53 | } 54 | m_CurrentTurnAmount = Mathf.SmoothDamp(m_CurrentTurnAmount, 1, ref m_TurnSpeedVelocityChange, m_SmoothTurnTime); 55 | } 56 | else 57 | { 58 | // we're in 'follow rotation' mode, where the camera rig's rotation follows the object's rotation. 59 | 60 | // This section allows the camera to stop following the target's rotation when the target is spinning too fast. 61 | // eg when a car has been knocked into a spin. The camera will resume following the rotation 62 | // of the target when the target's angular velocity slows below the threshold. 63 | var currentFlatAngle = Mathf.Atan2(targetForward.x, targetForward.z)*Mathf.Rad2Deg; 64 | if (m_SpinTurnLimit > 0) 65 | { 66 | var targetSpinSpeed = Mathf.Abs(Mathf.DeltaAngle(m_LastFlatAngle, currentFlatAngle))/deltaTime; 67 | var desiredTurnAmount = Mathf.InverseLerp(m_SpinTurnLimit, m_SpinTurnLimit*0.75f, targetSpinSpeed); 68 | var turnReactSpeed = (m_CurrentTurnAmount > desiredTurnAmount ? .1f : 1f); 69 | if (Application.isPlaying) 70 | { 71 | m_CurrentTurnAmount = Mathf.SmoothDamp(m_CurrentTurnAmount, desiredTurnAmount, 72 | ref m_TurnSpeedVelocityChange, turnReactSpeed); 73 | } 74 | else 75 | { 76 | // for editor mode, smoothdamp won't work because it uses deltaTime internally 77 | m_CurrentTurnAmount = desiredTurnAmount; 78 | } 79 | } 80 | else 81 | { 82 | m_CurrentTurnAmount = 1; 83 | } 84 | m_LastFlatAngle = currentFlatAngle; 85 | } 86 | 87 | // camera position moves towards target position: 88 | transform.position = Vector3.Lerp(transform.position, m_Target.position, deltaTime*m_MoveSpeed); 89 | 90 | // camera's rotation is split into two parts, which can have independend speed settings: 91 | // rotating towards the target's forward direction (which encompasses its 'yaw' and 'pitch') 92 | if (!m_FollowTilt) 93 | { 94 | targetForward.y = 0; 95 | if (targetForward.sqrMagnitude < float.Epsilon) 96 | { 97 | targetForward = transform.forward; 98 | } 99 | } 100 | var rollRotation = Quaternion.LookRotation(targetForward, m_RollUp); 101 | 102 | // and aligning with the target object's up direction (i.e. its 'roll') 103 | m_RollUp = m_RollSpeed > 0 ? Vector3.Slerp(m_RollUp, targetUp, m_RollSpeed*deltaTime) : Vector3.up; 104 | transform.rotation = Quaternion.Lerp(transform.rotation, rollRotation, m_TurnSpeed*m_CurrentTurnAmount*deltaTime); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/AutoCam.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8d3968294210ba4a9d2bb96dfa74a16 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/FreeLookCam.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Cameras 5 | { 6 | public class FreeLookCam : PivotBasedCameraRig 7 | { 8 | // This script is designed to be placed on the root object of a camera rig, 9 | // comprising 3 gameobjects, each parented to the next: 10 | 11 | // Camera Rig 12 | // Pivot 13 | // Camera 14 | 15 | [SerializeField] private float m_MoveSpeed = 1f; // How fast the rig will move to keep up with the target's position. 16 | [Range(0f, 10f)] [SerializeField] private float m_TurnSpeed = 1.5f; // How fast the rig will rotate from user input. 17 | [SerializeField] private float m_TurnSmoothing = 0.0f; // How much smoothing to apply to the turn input, to reduce mouse-turn jerkiness 18 | [SerializeField] private float m_TiltMax = 75f; // The maximum value of the x axis rotation of the pivot. 19 | [SerializeField] private float m_TiltMin = 45f; // The minimum value of the x axis rotation of the pivot. 20 | [SerializeField] private bool m_LockCursor = false; // Whether the cursor should be hidden and locked. 21 | [SerializeField] private bool m_VerticalAutoReturn = false; // set wether or not the vertical axis should auto return 22 | 23 | private float m_LookAngle; // The rig's y axis rotation. 24 | private float m_TiltAngle; // The pivot's x axis rotation. 25 | private Vector3 m_PivotEulers; 26 | private Quaternion m_PivotTargetRot; 27 | private Quaternion m_TransformTargetRot; 28 | 29 | protected override void Awake() 30 | { 31 | base.Awake(); 32 | // Lock or unlock the cursor. 33 | Cursor.lockState = m_LockCursor ? CursorLockMode.Locked : CursorLockMode.None; 34 | Cursor.visible = !m_LockCursor; 35 | m_PivotEulers = m_Pivot.rotation.eulerAngles; 36 | 37 | m_PivotTargetRot = m_Pivot.transform.localRotation; 38 | m_TransformTargetRot = transform.localRotation; 39 | } 40 | 41 | 42 | protected void Update() 43 | { 44 | HandleRotationMovement(); 45 | if (m_LockCursor && Input.GetMouseButtonUp(0)) 46 | { 47 | Cursor.lockState = m_LockCursor ? CursorLockMode.Locked : CursorLockMode.None; 48 | Cursor.visible = !m_LockCursor; 49 | } 50 | } 51 | 52 | 53 | private void OnDisable() 54 | { 55 | Cursor.lockState = CursorLockMode.None; 56 | Cursor.visible = true; 57 | } 58 | 59 | 60 | protected override void FollowTarget(float deltaTime) 61 | { 62 | if (m_Target == null) return; 63 | // Move the rig towards target position. 64 | transform.position = Vector3.Lerp(transform.position, m_Target.position, deltaTime*m_MoveSpeed); 65 | } 66 | 67 | 68 | private void HandleRotationMovement() 69 | { 70 | if(Time.timeScale < float.Epsilon) 71 | return; 72 | 73 | // Read the user input 74 | var x = Input.GetAxis("Mouse X"); 75 | var y = Input.GetAxis("Mouse Y"); 76 | 77 | // Adjust the look angle by an amount proportional to the turn speed and horizontal input. 78 | m_LookAngle += x*m_TurnSpeed; 79 | 80 | // Rotate the rig (the root object) around Y axis only: 81 | m_TransformTargetRot = Quaternion.Euler(0f, m_LookAngle, 0f); 82 | 83 | if (m_VerticalAutoReturn) 84 | { 85 | // For tilt input, we need to behave differently depending on whether we're using mouse or touch input: 86 | // on mobile, vertical input is directly mapped to tilt value, so it springs back automatically when the look input is released 87 | // we have to test whether above or below zero because we want to auto-return to zero even if min and max are not symmetrical. 88 | m_TiltAngle = y > 0 ? Mathf.Lerp(0, -m_TiltMin, y) : Mathf.Lerp(0, m_TiltMax, -y); 89 | } 90 | else 91 | { 92 | // on platforms with a mouse, we adjust the current angle based on Y mouse input and turn speed 93 | m_TiltAngle -= y*m_TurnSpeed; 94 | // and make sure the new value is within the tilt range 95 | m_TiltAngle = Mathf.Clamp(m_TiltAngle, -m_TiltMin, m_TiltMax); 96 | } 97 | 98 | // Tilt input around X is applied to the pivot (the child of this object) 99 | m_PivotTargetRot = Quaternion.Euler(m_TiltAngle, m_PivotEulers.y , m_PivotEulers.z); 100 | 101 | if (m_TurnSmoothing > 0) 102 | { 103 | m_Pivot.localRotation = Quaternion.Slerp(m_Pivot.localRotation, m_PivotTargetRot, m_TurnSmoothing * Time.deltaTime); 104 | transform.localRotation = Quaternion.Slerp(transform.localRotation, m_TransformTargetRot, m_TurnSmoothing * Time.deltaTime); 105 | } 106 | else 107 | { 108 | m_Pivot.localRotation = m_PivotTargetRot; 109 | transform.localRotation = m_TransformTargetRot; 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/FreeLookCam.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e44af8091779fcb40801d5b284353dbe 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/HandHeldCam.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Cameras 5 | { 6 | public class HandHeldCam : LookatTarget 7 | { 8 | [SerializeField] private float m_SwaySpeed = .5f; 9 | [SerializeField] private float m_BaseSwayAmount = .5f; 10 | [SerializeField] private float m_TrackingSwayAmount = .5f; 11 | [Range(-1, 1)] [SerializeField] private float m_TrackingBias = 0; 12 | 13 | 14 | protected override void FollowTarget(float deltaTime) 15 | { 16 | base.FollowTarget(deltaTime); 17 | 18 | float bx = (Mathf.PerlinNoise(0, Time.time*m_SwaySpeed) - 0.5f); 19 | float by = (Mathf.PerlinNoise(0, (Time.time*m_SwaySpeed) + 100)) - 0.5f; 20 | 21 | bx *= m_BaseSwayAmount; 22 | by *= m_BaseSwayAmount; 23 | 24 | float tx = (Mathf.PerlinNoise(0, Time.time*m_SwaySpeed) - 0.5f) + m_TrackingBias; 25 | float ty = ((Mathf.PerlinNoise(0, (Time.time*m_SwaySpeed) + 100)) - 0.5f) + m_TrackingBias; 26 | 27 | tx *= -m_TrackingSwayAmount*m_FollowVelocity.x; 28 | ty *= m_TrackingSwayAmount*m_FollowVelocity.y; 29 | 30 | transform.Rotate(bx + tx, by + ty, 0); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/HandHeldCam.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d947636a9390f6a46a121124154e6e3f 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/LookatTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Cameras 5 | { 6 | public class LookatTarget : AbstractTargetFollower 7 | { 8 | // A simple script to make one object look at another, 9 | // but with optional constraints which operate relative to 10 | // this gameobject's initial rotation. 11 | 12 | // Only rotates around local X and Y. 13 | 14 | // Works in local coordinates, so if this object is parented 15 | // to another moving gameobject, its local constraints will 16 | // operate correctly 17 | // (Think: looking out the side window of a car, or a gun turret 18 | // on a moving spaceship with a limited angular range) 19 | 20 | // to have no constraints on an axis, set the rotationRange greater than 360. 21 | 22 | [SerializeField] private Vector2 m_RotationRange; 23 | [SerializeField] private float m_FollowSpeed = 1; 24 | 25 | private Vector3 m_FollowAngles; 26 | private Quaternion m_OriginalRotation; 27 | 28 | protected Vector3 m_FollowVelocity; 29 | 30 | 31 | // Use this for initialization 32 | protected override void Start() 33 | { 34 | base.Start(); 35 | m_OriginalRotation = transform.localRotation; 36 | } 37 | 38 | 39 | protected override void FollowTarget(float deltaTime) 40 | { 41 | // we make initial calculations from the original local rotation 42 | transform.localRotation = m_OriginalRotation; 43 | 44 | // tackle rotation around Y first 45 | Vector3 localTarget = transform.InverseTransformPoint(m_Target.position); 46 | float yAngle = Mathf.Atan2(localTarget.x, localTarget.z)*Mathf.Rad2Deg; 47 | 48 | yAngle = Mathf.Clamp(yAngle, -m_RotationRange.y*0.5f, m_RotationRange.y*0.5f); 49 | transform.localRotation = m_OriginalRotation*Quaternion.Euler(0, yAngle, 0); 50 | 51 | // then recalculate new local target position for rotation around X 52 | localTarget = transform.InverseTransformPoint(m_Target.position); 53 | float xAngle = Mathf.Atan2(localTarget.y, localTarget.z)*Mathf.Rad2Deg; 54 | xAngle = Mathf.Clamp(xAngle, -m_RotationRange.x*0.5f, m_RotationRange.x*0.5f); 55 | var targetAngles = new Vector3(m_FollowAngles.x + Mathf.DeltaAngle(m_FollowAngles.x, xAngle), 56 | m_FollowAngles.y + Mathf.DeltaAngle(m_FollowAngles.y, yAngle)); 57 | 58 | // smoothly interpolate the current angles to the target angles 59 | m_FollowAngles = Vector3.SmoothDamp(m_FollowAngles, targetAngles, ref m_FollowVelocity, m_FollowSpeed); 60 | 61 | 62 | // and update the gameobject itself 63 | transform.localRotation = m_OriginalRotation*Quaternion.Euler(-m_FollowAngles.x, m_FollowAngles.y, 0); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/LookatTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2ec2b96de5640e42a622fc3064f1c80 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/PivotBasedCameraRig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UnityStandardAssets.Cameras 6 | { 7 | public abstract class PivotBasedCameraRig : AbstractTargetFollower 8 | { 9 | // This script is designed to be placed on the root object of a camera rig, 10 | // comprising 3 gameobjects, each parented to the next: 11 | 12 | // Camera Rig 13 | // Pivot 14 | // Camera 15 | 16 | protected Transform m_Cam; // the transform of the camera 17 | protected Transform m_Pivot; // the point at which the camera pivots around 18 | protected Vector3 m_LastTargetPosition; 19 | 20 | 21 | protected virtual void Awake() 22 | { 23 | // find the camera in the object hierarchy 24 | m_Cam = GetComponentInChildren().transform; 25 | m_Pivot = m_Cam.parent; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/PivotBasedCameraRig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58cb183e16853564e9ed457f8a296db1 3 | labels: 4 | - Done 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/ProtectCameraFromWallClip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | 5 | namespace UnityStandardAssets.Cameras 6 | { 7 | public class ProtectCameraFromWallClip : MonoBehaviour 8 | { 9 | public float clipMoveTime = 0.05f; // time taken to move when avoiding cliping (low value = fast, which it should be) 10 | public float returnTime = 0.4f; // time taken to move back towards desired position, when not clipping (typically should be a higher value than clipMoveTime) 11 | public float sphereCastRadius = 0.1f; // the radius of the sphere used to test for object between camera and target 12 | public bool visualiseInEditor; // toggle for visualising the algorithm through lines for the raycast in the editor 13 | public float closestDistance = 0.5f; // the closest distance the camera can be from the target 14 | public bool protecting { get; private set; } // used for determining if there is an object between the target and the camera 15 | public string dontClipTag = "Player"; // don't clip against objects with this tag (useful for not clipping against the targeted object) 16 | 17 | private Transform m_Cam; // the transform of the camera 18 | private Transform m_Pivot; // the point at which the camera pivots around 19 | private float m_OriginalDist; // the original distance to the camera before any modification are made 20 | private float m_MoveVelocity; // the velocity at which the camera moved 21 | private float m_CurrentDist; // the current distance from the camera to the target 22 | private Ray m_Ray = new Ray(); // the ray used in the lateupdate for casting between the camera and the target 23 | private RaycastHit[] m_Hits; // the hits between the camera and the target 24 | private RayHitComparer m_RayHitComparer; // variable to compare raycast hit distances 25 | 26 | 27 | private void Start() 28 | { 29 | // find the camera in the object hierarchy 30 | m_Cam = GetComponentInChildren().transform; 31 | m_Pivot = m_Cam.parent; 32 | m_OriginalDist = m_Cam.localPosition.magnitude; 33 | m_CurrentDist = m_OriginalDist; 34 | 35 | // create a new RayHitComparer 36 | m_RayHitComparer = new RayHitComparer(); 37 | } 38 | 39 | 40 | private void LateUpdate() 41 | { 42 | // initially set the target distance 43 | float targetDist = m_OriginalDist; 44 | 45 | m_Ray.origin = m_Pivot.position + m_Pivot.forward*sphereCastRadius; 46 | m_Ray.direction = -m_Pivot.forward; 47 | 48 | // initial check to see if start of spherecast intersects anything 49 | var cols = Physics.OverlapSphere(m_Ray.origin, sphereCastRadius); 50 | 51 | bool initialIntersect = false; 52 | bool hitSomething = false; 53 | 54 | // loop through all the collisions to check if something we care about 55 | for (int i = 0; i < cols.Length; i++) 56 | { 57 | if ((!cols[i].isTrigger) && 58 | !(cols[i].attachedRigidbody != null && cols[i].attachedRigidbody.CompareTag(dontClipTag))) 59 | { 60 | initialIntersect = true; 61 | break; 62 | } 63 | } 64 | 65 | // if there is a collision 66 | if (initialIntersect) 67 | { 68 | m_Ray.origin += m_Pivot.forward*sphereCastRadius; 69 | 70 | // do a raycast and gather all the intersections 71 | m_Hits = Physics.RaycastAll(m_Ray, m_OriginalDist - sphereCastRadius); 72 | } 73 | else 74 | { 75 | // if there was no collision do a sphere cast to see if there were any other collisions 76 | m_Hits = Physics.SphereCastAll(m_Ray, sphereCastRadius, m_OriginalDist + sphereCastRadius); 77 | } 78 | 79 | // sort the collisions by distance 80 | Array.Sort(m_Hits, m_RayHitComparer); 81 | 82 | // set the variable used for storing the closest to be as far as possible 83 | float nearest = Mathf.Infinity; 84 | 85 | // loop through all the collisions 86 | for (int i = 0; i < m_Hits.Length; i++) 87 | { 88 | // only deal with the collision if it was closer than the previous one, not a trigger, and not attached to a rigidbody tagged with the dontClipTag 89 | if (m_Hits[i].distance < nearest && (!m_Hits[i].collider.isTrigger) && 90 | !(m_Hits[i].collider.attachedRigidbody != null && 91 | m_Hits[i].collider.attachedRigidbody.CompareTag(dontClipTag))) 92 | { 93 | // change the nearest collision to latest 94 | nearest = m_Hits[i].distance; 95 | targetDist = -m_Pivot.InverseTransformPoint(m_Hits[i].point).z; 96 | hitSomething = true; 97 | } 98 | } 99 | 100 | // visualise the cam clip effect in the editor 101 | if (hitSomething) 102 | { 103 | Debug.DrawRay(m_Ray.origin, -m_Pivot.forward*(targetDist + sphereCastRadius), Color.red); 104 | } 105 | 106 | // hit something so move the camera to a better position 107 | protecting = hitSomething; 108 | m_CurrentDist = Mathf.SmoothDamp(m_CurrentDist, targetDist, ref m_MoveVelocity, 109 | m_CurrentDist > targetDist ? clipMoveTime : returnTime); 110 | m_CurrentDist = Mathf.Clamp(m_CurrentDist, closestDistance, m_OriginalDist); 111 | m_Cam.localPosition = -Vector3.forward*m_CurrentDist; 112 | } 113 | 114 | 115 | // comparer for check distances in ray cast hits 116 | public class RayHitComparer : IComparer 117 | { 118 | public int Compare(object x, object y) 119 | { 120 | return ((RaycastHit) x).distance.CompareTo(((RaycastHit) y).distance); 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/ProtectCameraFromWallClip.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94b04ec3bda6b7747aa53936ef3b0ae2 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/TargetFieldOfView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UnityStandardAssets.Cameras 6 | { 7 | public class TargetFieldOfView : AbstractTargetFollower 8 | { 9 | // This script is primarily designed to be used with the "LookAtTarget" script to enable a 10 | // CCTV style camera looking at a target to also adjust its field of view (zoom) to fit the 11 | // target (so that it zooms in as the target becomes further away). 12 | // When used with a follow cam, it will automatically use the same target. 13 | 14 | [SerializeField] private float m_FovAdjustTime = 1; // the time taken to adjust the current FOV to the desired target FOV amount. 15 | [SerializeField] private float m_ZoomAmountMultiplier = 2; // a multiplier for the FOV amount. The default of 2 makes the field of view twice as wide as required to fit the target. 16 | [SerializeField] private bool m_IncludeEffectsInSize = false; // changing this only takes effect on startup, or when new target is assigned. 17 | 18 | private float m_BoundSize; 19 | private float m_FovAdjustVelocity; 20 | private Camera m_Cam; 21 | private Transform m_LastTarget; 22 | 23 | // Use this for initialization 24 | protected override void Start() 25 | { 26 | base.Start(); 27 | m_BoundSize = MaxBoundsExtent(m_Target, m_IncludeEffectsInSize); 28 | 29 | // get a reference to the actual camera component: 30 | m_Cam = GetComponentInChildren(); 31 | } 32 | 33 | 34 | protected override void FollowTarget(float deltaTime) 35 | { 36 | // calculate the correct field of view to fit the bounds size at the current distance 37 | float dist = (m_Target.position - transform.position).magnitude; 38 | float requiredFOV = Mathf.Atan2(m_BoundSize, dist)*Mathf.Rad2Deg*m_ZoomAmountMultiplier; 39 | 40 | m_Cam.fieldOfView = Mathf.SmoothDamp(m_Cam.fieldOfView, requiredFOV, ref m_FovAdjustVelocity, m_FovAdjustTime); 41 | } 42 | 43 | 44 | public override void SetTarget(Transform newTransform) 45 | { 46 | base.SetTarget(newTransform); 47 | m_BoundSize = MaxBoundsExtent(newTransform, m_IncludeEffectsInSize); 48 | } 49 | 50 | 51 | public static float MaxBoundsExtent(Transform obj, bool includeEffects) 52 | { 53 | // get the maximum bounds extent of object, including all child renderers, 54 | // but excluding particles and trails, for FOV zooming effect. 55 | 56 | var renderers = obj.GetComponentsInChildren(); 57 | 58 | Bounds bounds = new Bounds(); 59 | bool initBounds = false; 60 | foreach (Renderer r in renderers) 61 | { 62 | if (!((r is TrailRenderer) || (r is ParticleSystemRenderer))) 63 | { 64 | if (!initBounds) 65 | { 66 | initBounds = true; 67 | bounds = r.bounds; 68 | } 69 | else 70 | { 71 | bounds.Encapsulate(r.bounds); 72 | } 73 | } 74 | } 75 | float max = Mathf.Max(bounds.extents.x, bounds.extents.y, bounds.extents.z); 76 | return max; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Cameras/Scripts/TargetFieldOfView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a62942d9af3f36d448094c6ed1f214dd 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d8829ac873af27488b1412b8db301ab 3 | folderAsset: yes 4 | timeCreated: 1436977287 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35e5b60069b1d4945af0cbaefb902d02 3 | folderAsset: yes 4 | timeCreated: 1436977288 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavyDarkGrid.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 4 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: NavyDarkGrid 10 | m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION _EMISSIONMAP _LIGHTMAPPING_DYNAMIC_LIGHTMAPS _LIGHTMAPPING_REALTIME 12 | _UVSEC_UV1 13 | m_CustomRenderQueue: -1 14 | m_SavedProperties: 15 | serializedVersion: 2 16 | m_TexEnvs: 17 | data: 18 | first: 19 | name: _MainTex 20 | second: 21 | m_Texture: {fileID: 2800000, guid: b64756a3fbf7f7e42b02aa3aa8669374, type: 3} 22 | m_Scale: {x: 4, y: 4} 23 | m_Offset: {x: 0, y: 0} 24 | data: 25 | first: 26 | name: _BumpMap 27 | second: 28 | m_Texture: {fileID: 0} 29 | m_Scale: {x: 1, y: 1} 30 | m_Offset: {x: 0, y: 0} 31 | data: 32 | first: 33 | name: _DetailNormalMap 34 | second: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | data: 39 | first: 40 | name: _EmissionMap 41 | second: 42 | m_Texture: {fileID: 2800000, guid: f12438971f1ef65478bf3b3f12e0aab4, type: 3} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | data: 46 | first: 47 | name: _ParallaxMap 48 | second: 49 | m_Texture: {fileID: 0} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | data: 53 | first: 54 | name: _Occlusion 55 | second: 56 | m_Texture: {fileID: 0} 57 | m_Scale: {x: 1, y: 1} 58 | m_Offset: {x: 0, y: 0} 59 | data: 60 | first: 61 | name: _SpecGlossMap 62 | second: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | data: 67 | first: 68 | name: _DetailMask 69 | second: 70 | m_Texture: {fileID: 0} 71 | m_Scale: {x: 1, y: 1} 72 | m_Offset: {x: 0, y: 0} 73 | data: 74 | first: 75 | name: _DetailAlbedoMap 76 | second: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | data: 81 | first: 82 | name: _OcclusionMap 83 | second: 84 | m_Texture: {fileID: 0} 85 | m_Scale: {x: 1, y: 1} 86 | m_Offset: {x: 0, y: 0} 87 | data: 88 | first: 89 | name: _MetallicGlossMap 90 | second: 91 | m_Texture: {fileID: 0} 92 | m_Scale: {x: 1, y: 1} 93 | m_Offset: {x: 0, y: 0} 94 | m_Floats: 95 | data: 96 | first: 97 | name: _AlphaTestRef 98 | second: .5 99 | data: 100 | first: 101 | name: _Lightmapping 102 | second: 1 103 | data: 104 | first: 105 | name: _SrcBlend 106 | second: 1 107 | data: 108 | first: 109 | name: _DstBlend 110 | second: 0 111 | data: 112 | first: 113 | name: _Parallax 114 | second: .0199999996 115 | data: 116 | first: 117 | name: _ZWrite 118 | second: 1 119 | data: 120 | first: 121 | name: _Glossiness 122 | second: .100000001 123 | data: 124 | first: 125 | name: _BumpScale 126 | second: 1 127 | data: 128 | first: 129 | name: _OcclusionStrength 130 | second: 1 131 | data: 132 | first: 133 | name: _DetailNormalMapScale 134 | second: 1 135 | data: 136 | first: 137 | name: _UVSec 138 | second: 0 139 | data: 140 | first: 141 | name: _Mode 142 | second: 0 143 | data: 144 | first: 145 | name: _EmissionScaleUI 146 | second: 2 147 | data: 148 | first: 149 | name: _Metallic 150 | second: .100000001 151 | m_Colors: 152 | data: 153 | first: 154 | name: _EmissionColor 155 | second: {r: 1.33483374, g: 1.33483374, b: 1.33483374, a: 1.33483374} 156 | data: 157 | first: 158 | name: _Color 159 | second: {r: 1, g: 1, b: 1, a: 1} 160 | data: 161 | first: 162 | name: _SpecularColor 163 | second: {r: .156862751, g: .156862751, b: .156862751, a: 1} 164 | data: 165 | first: 166 | name: _EmissionColorUI 167 | second: {r: 0, g: 0, b: 0, a: 1} 168 | data: 169 | first: 170 | name: _EmissionColorWithMapUI 171 | second: {r: 1, g: 1, b: 1, a: 1} 172 | data: 173 | first: 174 | name: _SpecColor 175 | second: {r: .117647059, g: .117647059, b: .117647059, a: 1} 176 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavyDarkGrid.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01c04496878436140922b19f5220712b 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavyDarkSmooth.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Materials/NavyDarkSmooth.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavyDarkSmooth.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 338dbf9d35df70d428453cc78f8eaa18 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavyGrid.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Materials/NavyGrid.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavyGrid.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 297e3a11e7d07fc48b4f71056b4f927f 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavySmooth.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Materials/NavySmooth.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/NavySmooth.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bccdb449802ea144b8709da9bac60356 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/WhiteSmooth.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Materials/WhiteSmooth.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Materials/WhiteSmooth.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 616853845a4a54949ac851f2f807aa2a 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92a62c583a2e8734d9a6018eec4d27fb 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/GroundObstacles.FBX: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Models/GroundObstacles.FBX -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/GroundObstacles.FBX.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f57127cfcc32ab9419af130b6a9211fb 3 | ModelImporter: 4 | serializedVersion: 18 5 | fileIDToRecycleName: 6 | 100000: GroundExtents 7 | 100002: //RootNode 8 | 100004: GroundLines 9 | 100006: GroundObstacles 10 | 400000: GroundExtents 11 | 400002: //RootNode 12 | 400004: GroundLines 13 | 400006: GroundObstacles 14 | 2300000: GroundExtents 15 | 2300002: GroundLines 16 | 2300004: GroundObstacles 17 | 3300000: GroundExtents 18 | 3300002: GroundLines 19 | 3300004: GroundObstacles 20 | 4300000: GroundExtents 21 | 4300002: GroundLines 22 | 4300004: GroundObstacles 23 | materials: 24 | importMaterials: 1 25 | materialName: 0 26 | materialSearch: 1 27 | animations: 28 | legacyGenerateAnimations: 4 29 | bakeSimulation: 0 30 | optimizeGameObjects: 0 31 | motionNodeName: 32 | pivotNodeName: 33 | animationCompression: 1 34 | animationRotationError: .5 35 | animationPositionError: .5 36 | animationScaleError: .5 37 | animationWrapMode: 0 38 | extraExposedTransformPaths: [] 39 | clipAnimations: [] 40 | isReadable: 1 41 | meshes: 42 | lODScreenPercentages: [] 43 | globalScale: 1 44 | meshCompression: 0 45 | addColliders: 0 46 | importBlendShapes: 1 47 | swapUVChannels: 0 48 | generateSecondaryUV: 0 49 | useFileUnits: 1 50 | optimizeMeshForGPU: 1 51 | keepQuads: 0 52 | weldVertices: 1 53 | secondaryUVAngleDistortion: 8 54 | secondaryUVAreaDistortion: 15.000001 55 | secondaryUVHardAngle: 88 56 | secondaryUVPackMargin: 4 57 | useFileScale: 1 58 | tangentSpace: 59 | normalSmoothAngle: 60 60 | splitTangentsAcrossUV: 1 61 | normalImportMode: 0 62 | tangentImportMode: 1 63 | importAnimation: 1 64 | copyAvatar: 0 65 | humanDescription: 66 | human: [] 67 | skeleton: [] 68 | armTwist: .5 69 | foreArmTwist: .5 70 | upperLegTwist: .5 71 | legTwist: .5 72 | armStretch: .0500000007 73 | legStretch: .0500000007 74 | feetSpacing: 0 75 | rootMotionBoneName: 76 | lastHumanDescriptionAvatarSource: {instanceID: 0} 77 | animationType: 0 78 | additionalBone: 0 79 | userData: 80 | assetBundleName: 81 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/GroundTrack.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Models/GroundTrack.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/GroundTrack.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2afa5a1773ca1f84f98c062866a8be55 3 | ModelImporter: 4 | serializedVersion: 18 5 | fileIDToRecycleName: 6 | 100000: FloorExtents 7 | 100002: //RootNode 8 | 100004: FloorTrack 9 | 100006: FloorVerges 10 | 100008: GroundExtents 11 | 100010: GroundTrack 12 | 100012: GroundVerges 13 | 100014: WallExtents 14 | 100016: GroundTrackExtents 15 | 100018: GroundTrackTarmac 16 | 100020: GroundTrackVerges 17 | 100022: GroundTrackWall 18 | 100024: Ground 19 | 400000: FloorExtents 20 | 400002: //RootNode 21 | 400004: FloorTrack 22 | 400006: FloorVerges 23 | 400008: GroundExtents 24 | 400010: GroundTrack 25 | 400012: GroundVerges 26 | 400014: WallExtents 27 | 400016: GroundTrackExtents 28 | 400018: GroundTrackTarmac 29 | 400020: GroundTrackVerges 30 | 400022: GroundTrackWall 31 | 400024: Ground 32 | 2300000: FloorExtents 33 | 2300002: FloorTrack 34 | 2300004: FloorVerges 35 | 2300006: GroundExtents 36 | 2300008: GroundTrack 37 | 2300010: GroundVerges 38 | 2300012: WallExtents 39 | 2300014: GroundTrackExtents 40 | 2300016: GroundTrackTarmac 41 | 2300018: GroundTrackVerges 42 | 2300020: GroundTrackWall 43 | 2300022: Ground 44 | 3300000: FloorExtents 45 | 3300002: FloorTrack 46 | 3300004: FloorVerges 47 | 3300006: GroundExtents 48 | 3300008: GroundTrack 49 | 3300010: GroundVerges 50 | 3300012: WallExtents 51 | 3300014: GroundTrackExtents 52 | 3300016: GroundTrackTarmac 53 | 3300018: GroundTrackVerges 54 | 3300020: GroundTrackWall 55 | 3300022: Ground 56 | 4300000: FloorVerges 57 | 4300002: FloorExtents 58 | 4300004: FloorTrack 59 | 4300006: GroundVerges 60 | 4300008: GroundExtents 61 | 4300010: GroundTrack 62 | 4300012: WallExtents 63 | 4300014: GroundTrackVerges 64 | 4300016: GroundTrackTarmac 65 | 4300018: GroundTrackExtents 66 | 4300020: GroundTrackWall 67 | 4300022: Ground 68 | 9500000: //RootNode 69 | materials: 70 | importMaterials: 1 71 | materialName: 1 72 | materialSearch: 2 73 | animations: 74 | legacyGenerateAnimations: 4 75 | bakeSimulation: 0 76 | optimizeGameObjects: 0 77 | motionNodeName: 78 | pivotNodeName: 79 | animationCompression: 1 80 | animationRotationError: .5 81 | animationPositionError: .5 82 | animationScaleError: .5 83 | animationWrapMode: 0 84 | extraExposedTransformPaths: [] 85 | clipAnimations: [] 86 | isReadable: 1 87 | meshes: 88 | lODScreenPercentages: [] 89 | globalScale: .00999999978 90 | meshCompression: 0 91 | addColliders: 0 92 | importBlendShapes: 1 93 | swapUVChannels: 0 94 | generateSecondaryUV: 0 95 | useFileUnits: 0 96 | optimizeMeshForGPU: 1 97 | keepQuads: 0 98 | weldVertices: 1 99 | secondaryUVAngleDistortion: 8 100 | secondaryUVAreaDistortion: 15.000001 101 | secondaryUVHardAngle: 88 102 | secondaryUVPackMargin: 4 103 | useFileScale: 0 104 | tangentSpace: 105 | normalSmoothAngle: 60 106 | splitTangentsAcrossUV: 1 107 | normalImportMode: 0 108 | tangentImportMode: 1 109 | importAnimation: 1 110 | copyAvatar: 0 111 | humanDescription: 112 | human: [] 113 | skeleton: [] 114 | armTwist: .5 115 | foreArmTwist: .5 116 | upperLegTwist: .5 117 | legTwist: .5 118 | armStretch: .0500000007 119 | legStretch: .0500000007 120 | feetSpacing: 0 121 | rootMotionBoneName: 122 | lastHumanDescriptionAvatarSource: {instanceID: 0} 123 | animationType: 0 124 | additionalBone: 0 125 | userData: 126 | assetBundleName: 127 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/MiniRamps.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Models/MiniRamps.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/MiniRamps.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b87e14348acae3449a86167ae5521ac4 3 | ModelImporter: 4 | serializedVersion: 18 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: MiniRampsPrototype 11 | materials: 12 | importMaterials: 1 13 | materialName: 1 14 | materialSearch: 2 15 | animations: 16 | legacyGenerateAnimations: 4 17 | bakeSimulation: 0 18 | optimizeGameObjects: 0 19 | motionNodeName: 20 | pivotNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: 1 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | keepQuads: 0 40 | weldVertices: 1 41 | secondaryUVAngleDistortion: 8 42 | secondaryUVAreaDistortion: 15.000001 43 | secondaryUVHardAngle: 88 44 | secondaryUVPackMargin: 4 45 | useFileScale: 1 46 | tangentSpace: 47 | normalSmoothAngle: 60 48 | splitTangentsAcrossUV: 1 49 | normalImportMode: 0 50 | tangentImportMode: 1 51 | importAnimation: 1 52 | copyAvatar: 0 53 | humanDescription: 54 | human: [] 55 | skeleton: [] 56 | armTwist: .5 57 | foreArmTwist: .5 58 | upperLegTwist: .5 59 | legTwist: .5 60 | armStretch: .0500000007 61 | legStretch: .0500000007 62 | feetSpacing: 0 63 | rootMotionBoneName: 64 | lastHumanDescriptionAvatarSource: {instanceID: 0} 65 | animationType: 0 66 | additionalBone: 0 67 | userData: 68 | assetBundleName: 69 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/Platform.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Models/Platform.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/Platform.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41807bb6e4134a34aaf92fbad2e07bbc 3 | ModelImporter: 4 | serializedVersion: 18 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: platform_prototype_2x1x2 11 | 4300002: PlatformPrototype02x01x02 12 | 4300004: Platform 13 | 6400000: //RootNode 14 | 9500000: //RootNode 15 | materials: 16 | importMaterials: 1 17 | materialName: 1 18 | materialSearch: 2 19 | animations: 20 | legacyGenerateAnimations: 4 21 | bakeSimulation: 0 22 | optimizeGameObjects: 0 23 | motionNodeName: 24 | pivotNodeName: 25 | animationCompression: 1 26 | animationRotationError: .5 27 | animationPositionError: .5 28 | animationScaleError: .5 29 | animationWrapMode: 0 30 | extraExposedTransformPaths: [] 31 | clipAnimations: [] 32 | isReadable: 1 33 | meshes: 34 | lODScreenPercentages: [] 35 | globalScale: .00999999978 36 | meshCompression: 0 37 | addColliders: 0 38 | importBlendShapes: 1 39 | swapUVChannels: 0 40 | generateSecondaryUV: 0 41 | useFileUnits: 0 42 | optimizeMeshForGPU: 1 43 | keepQuads: 0 44 | weldVertices: 1 45 | secondaryUVAngleDistortion: 8 46 | secondaryUVAreaDistortion: 15.000001 47 | secondaryUVHardAngle: 88 48 | secondaryUVPackMargin: 4 49 | useFileScale: 0 50 | tangentSpace: 51 | normalSmoothAngle: 60 52 | splitTangentsAcrossUV: 1 53 | normalImportMode: 0 54 | tangentImportMode: 1 55 | importAnimation: 1 56 | copyAvatar: 0 57 | humanDescription: 58 | human: [] 59 | skeleton: [] 60 | armTwist: .5 61 | foreArmTwist: .5 62 | upperLegTwist: .5 63 | legTwist: .5 64 | armStretch: .0500000007 65 | legStretch: .0500000007 66 | feetSpacing: 0 67 | rootMotionBoneName: 68 | lastHumanDescriptionAvatarSource: {instanceID: 0} 69 | animationType: 0 70 | additionalBone: 0 71 | userData: 72 | assetBundleName: 73 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/PrimaryJumpRamp.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Models/PrimaryJumpRamp.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Models/PrimaryJumpRamp.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5a593bc7144a6c45b7a3d4543355ec4 3 | ModelImporter: 4 | serializedVersion: 18 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: PrimaryJumpRamp 11 | materials: 12 | importMaterials: 1 13 | materialName: 0 14 | materialSearch: 1 15 | animations: 16 | legacyGenerateAnimations: 4 17 | bakeSimulation: 0 18 | optimizeGameObjects: 0 19 | motionNodeName: 20 | pivotNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: 1 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | keepQuads: 0 40 | weldVertices: 1 41 | secondaryUVAngleDistortion: 8 42 | secondaryUVAreaDistortion: 15.000001 43 | secondaryUVHardAngle: 88 44 | secondaryUVPackMargin: 4 45 | useFileScale: 1 46 | tangentSpace: 47 | normalSmoothAngle: 60 48 | splitTangentsAcrossUV: 1 49 | normalImportMode: 0 50 | tangentImportMode: 1 51 | importAnimation: 1 52 | copyAvatar: 0 53 | humanDescription: 54 | human: [] 55 | skeleton: [] 56 | armTwist: .5 57 | foreArmTwist: .5 58 | upperLegTwist: .5 59 | legTwist: .5 60 | armStretch: .0500000007 61 | legStretch: .0500000007 62 | feetSpacing: 0 63 | rootMotionBoneName: 64 | lastHumanDescriptionAvatarSource: {instanceID: 0} 65 | animationType: 0 66 | additionalBone: 0 67 | userData: 68 | assetBundleName: 69 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 086f32566457e9b4399348747e15d7a8 3 | folderAsset: yes 4 | timeCreated: 1436977288 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures/GridEmissive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Textures/GridEmissive.png -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures/GridEmissive.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f12438971f1ef65478bf3b3f12e0aab4 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 12 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaIsTransparency: 0 46 | textureType: -1 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | assetBundleVariant: 54 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures/SwatchNavyAlbedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Textures/SwatchNavyAlbedo.png -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures/SwatchNavyAlbedo.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee5f9bf88befa4e4eb6ac1d74dae4051 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 32 29 | textureSettings: 30 | filterMode: -1 31 | aniso: 0 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaIsTransparency: 0 46 | textureType: -1 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures/SwatchNavyDarkAlbedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/SampleScenes/Textures/SwatchNavyDarkAlbedo.png -------------------------------------------------------------------------------- /Assets/Standard Assets/SampleScenes/Textures/SwatchNavyDarkAlbedo.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b64756a3fbf7f7e42b02aa3aa8669374 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaIsTransparency: 0 46 | textureType: -1 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91c9eb0d68c3aa9468278099737303a2 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09cfa44c71dfd864283e08dc3fa7fb4b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/CarGuidelines.txt: -------------------------------------------------------------------------------- 1 | In the Car folder you'll find a few ready-made Car prefabs, which are used in the Car sample scenes. These prefabs demonstrate how you can use the Car scripts we've included, including some AI-controlled variants which are able to drive directly towards a specified target, or follow a waypoint-based route. 2 | 3 | The scripts included have been designed to be modular in nature, so that the extra features of a particular car can be set up (such as brake lights, engine sound, and skid trails). 4 | 5 | The simplest way to get started setting up your own car is to use our "CarPrefabEmpty", and to follow these steps: 6 | 7 | 1) Start with a suitable scene. There ought to be enough flat ground to drive around on. 8 | 9 | 2) Place the "CarPrefabEmpty" in the scene. 10 | 11 | 3) Place your 3d model into the scene, as a child of the "CarPrefabEmpty" GameObject. Notice that your car model should be at the same level as the "WheelHub" objects that were already present. 12 | 13 | 4) Make sure your car's position in the inspector is set to 0,0,0. This will ensure your car's position is aligned with the Empty Prefab's position. 14 | 15 | 5) Expand the hierarchy of your car model in the hierarchy so that the wheel models of your car are visible. 16 | 17 | 6) Select each "WheelHub" in turn, and drag the corresponding wheel model from your car into the "Wheel Model" slot of the Wheel component on the WheelHub GameObject. Then click the "Align to assigned wheel model". If your car has four wheels, you'll need to do this step four times, once for each wheel. 18 | 19 | 7) Hit play, and try driving your car! 20 | 21 | You'll probably want to add a camera rig so that the camera follows the car as it drives off. See the Camera Rig guidelines for instructions on how to do that. 22 | 23 | The Car script exposes a number of properties which determine the power, maximum speed, and handling of the car, however ultimately the script is designed to provide a fun arcade game-like feel rather than attempting to be a realistic simulation of car handling. The gears and revs values are purely cosmetic, and are calculated retrospectively - they can be used by the engine sound component or GUI to display revs and gear. 24 | 25 | For more detail about each setting, see the comments in the script. 26 | 27 | The CarUserControl script takes input from the "CrossPlatformInput" class included in the sample assets, however if you're not targeting mobile or prefer to use a different system to read input, you can simply use unity's built in Input class in place of CrossPlatformInput. For more information, see the Cross Platform Input guidelines. 28 | 29 | The sample scenes provided work on standalone builds and also include cross platform touch and tilt controls which are set up and ready to publish to mobile. 30 | 31 | The CarAIControl component can be added instead of the CarUserControl component, allowing the car to be AI controlled. You can set it up to either head towards a specified target, or (by using the WaypointProgressTracker) follow a waypoint-defined route. See the WaypointCircuit guidelines for instructions. -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/CarGuidelines.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c51c09bcabc8c1441afe23a1da5fb6d8 3 | TextScriptImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7404f79cd1f1cf04492f2326283a7bb5 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Materials/SkyCarBodyGrey.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Materials/SkyCarBodyGrey.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Materials/SkyCarBodyGrey.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d425c5c4cb38fd44f95b13e9f94575c2 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6368f4c411282e0448e9431054707929 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1e6e8ea7e288dd4096cc775b8237464 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarBodyWhite.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarBodyWhite.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarBodyWhite.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6071444200f92624c94f5be54ba1c293 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarLightCoversWhite.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarLightCoversWhite.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarLightCoversWhite.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3645cde0372dbfd44a1a83fc297ed623 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarLightGlows.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarLightGlows.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarLightGlows.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 918131c98c3a17642b23dd2d8349bbf0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarWheelWhite.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarWheelWhite.mat -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/Materials/SkyCarWheelWhite.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a2e3a16771c3ea46b630f7b85856e78 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/SkyCar.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Models/SkyCar.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Models/SkyCar.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6fec471c20b9d148b1f87910e67bea4 3 | ModelImporter: 4 | serializedVersion: 19 5 | fileIDToRecycleName: 6 | 100000: vehicle_skyCar_body_paintwork 7 | 100002: vehicle_skyCar_body_parts 8 | 100004: vehicle_skyCar_mudGuard_frontLeft 9 | 100006: vehicle_skyCar_mudGuard_frontRight 10 | 100008: vehicle_skyCar_suspension_frontLeft 11 | 100010: vehicle_skyCar_suspension_frontRight 12 | 100012: //RootNode 13 | 100014: vehicle_skyCar_underside 14 | 100016: vehicle_skyCar_wheel_frontLeft 15 | 100018: vehicle_skyCar_wheel_frontRight 16 | 100020: vehicle_skyCar_wheel_rearLeft 17 | 100022: vehicle_skyCar_wheel_rearRight 18 | 100024: pPlane2 19 | 100026: transform2 20 | 100028: vehicle_skyCar_brakeLights 21 | 100030: vehicle_skyCar_headLights 22 | 100032: vehicle_skyCar_brakeLights_glow 23 | 100034: vehicle_skyCar_headLights_glow 24 | 100036: SkyCarBodyPaintwork 25 | 100038: SkyCarBodyParts 26 | 100040: SkyCarBrakeLightsGlow 27 | 100042: SkyCarHeadLightsGlow 28 | 100044: SkyCarMudGuardFrontLeft 29 | 100046: SkyCarMudGuardFrontRight 30 | 100048: SkyCarSuspensionFrontLeft 31 | 100050: SkyCarSuspensionFrontRight 32 | 100052: SkyCarUndercarriage 33 | 100054: SkyCarWheelFrontLeft 34 | 100056: SkyCarWheelFrontRight 35 | 100058: SkyCarWheelRearLeft 36 | 100060: SkyCarWheelRearRight 37 | 100062: SkyCarParts 38 | 100064: SkyCarParts_MeshPart0 39 | 100066: SkyCarParts_MeshPart1 40 | 100068: SkyCarBody 41 | 100070: SkyCarComponents 42 | 400000: vehicle_skyCar_body_paintwork 43 | 400002: vehicle_skyCar_body_parts 44 | 400004: vehicle_skyCar_mudGuard_frontLeft 45 | 400006: vehicle_skyCar_mudGuard_frontRight 46 | 400008: vehicle_skyCar_suspension_frontLeft 47 | 400010: vehicle_skyCar_suspension_frontRight 48 | 400012: //RootNode 49 | 400014: vehicle_skyCar_underside 50 | 400016: vehicle_skyCar_wheel_frontLeft 51 | 400018: vehicle_skyCar_wheel_frontRight 52 | 400020: vehicle_skyCar_wheel_rearLeft 53 | 400022: vehicle_skyCar_wheel_rearRight 54 | 400024: pPlane2 55 | 400026: transform2 56 | 400028: vehicle_skyCar_brakeLights 57 | 400030: vehicle_skyCar_headLights 58 | 400032: vehicle_skyCar_brakeLights_glow 59 | 400034: vehicle_skyCar_headLights_glow 60 | 400036: SkyCarBodyPaintwork 61 | 400038: SkyCarBodyParts 62 | 400040: SkyCarBrakeLightsGlow 63 | 400042: SkyCarHeadLightsGlow 64 | 400044: SkyCarMudGuardFrontLeft 65 | 400046: SkyCarMudGuardFrontRight 66 | 400048: SkyCarSuspensionFrontLeft 67 | 400050: SkyCarSuspensionFrontRight 68 | 400052: SkyCarUndercarriage 69 | 400054: SkyCarWheelFrontLeft 70 | 400056: SkyCarWheelFrontRight 71 | 400058: SkyCarWheelRearLeft 72 | 400060: SkyCarWheelRearRight 73 | 400062: SkyCarParts 74 | 400064: SkyCarParts_MeshPart0 75 | 400066: SkyCarParts_MeshPart1 76 | 400068: SkyCarBody 77 | 400070: SkyCarComponents 78 | 2300000: vehicle_skyCar_body_paintwork 79 | 2300002: vehicle_skyCar_body_parts 80 | 2300004: vehicle_skyCar_mudGuard_frontLeft 81 | 2300006: vehicle_skyCar_mudGuard_frontRight 82 | 2300008: vehicle_skyCar_suspension_frontLeft 83 | 2300010: vehicle_skyCar_suspension_frontRight 84 | 2300012: vehicle_skyCar_underside 85 | 2300014: vehicle_skyCar_wheel_frontLeft 86 | 2300016: vehicle_skyCar_wheel_frontRight 87 | 2300018: vehicle_skyCar_wheel_rearLeft 88 | 2300020: vehicle_skyCar_wheel_rearRight 89 | 2300022: vehicle_skyCar_brakeLights 90 | 2300024: vehicle_skyCar_headLights 91 | 2300026: vehicle_skyCar_brakeLights_glow 92 | 2300028: vehicle_skyCar_headLights_glow 93 | 2300030: SkyCarBodyPaintwork 94 | 2300032: SkyCarBodyParts 95 | 2300034: SkyCarBrakeLightsGlow 96 | 2300036: SkyCarHeadLightsGlow 97 | 2300038: SkyCarMudGuardFrontLeft 98 | 2300040: SkyCarMudGuardFrontRight 99 | 2300042: SkyCarSuspensionFrontLeft 100 | 2300044: SkyCarSuspensionFrontRight 101 | 2300046: SkyCarUndercarriage 102 | 2300048: SkyCarWheelFrontLeft 103 | 2300050: SkyCarWheelFrontRight 104 | 2300052: SkyCarWheelRearLeft 105 | 2300054: SkyCarWheelRearRight 106 | 2300056: SkyCarParts_MeshPart0 107 | 2300058: SkyCarParts_MeshPart1 108 | 2300060: SkyCarBody 109 | 2300062: SkyCarComponents 110 | 3300000: vehicle_skyCar_body_paintwork 111 | 3300002: vehicle_skyCar_body_parts 112 | 3300004: vehicle_skyCar_mudGuard_frontLeft 113 | 3300006: vehicle_skyCar_mudGuard_frontRight 114 | 3300008: vehicle_skyCar_suspension_frontLeft 115 | 3300010: vehicle_skyCar_suspension_frontRight 116 | 3300012: vehicle_skyCar_underside 117 | 3300014: vehicle_skyCar_wheel_frontLeft 118 | 3300016: vehicle_skyCar_wheel_frontRight 119 | 3300018: vehicle_skyCar_wheel_rearLeft 120 | 3300020: vehicle_skyCar_wheel_rearRight 121 | 3300022: vehicle_skyCar_brakeLights 122 | 3300024: vehicle_skyCar_headLights 123 | 3300026: vehicle_skyCar_brakeLights_glow 124 | 3300028: vehicle_skyCar_headLights_glow 125 | 3300030: SkyCarBodyPaintwork 126 | 3300032: SkyCarBodyParts 127 | 3300034: SkyCarBrakeLightsGlow 128 | 3300036: SkyCarHeadLightsGlow 129 | 3300038: SkyCarMudGuardFrontLeft 130 | 3300040: SkyCarMudGuardFrontRight 131 | 3300042: SkyCarSuspensionFrontLeft 132 | 3300044: SkyCarSuspensionFrontRight 133 | 3300046: SkyCarUndercarriage 134 | 3300048: SkyCarWheelFrontLeft 135 | 3300050: SkyCarWheelFrontRight 136 | 3300052: SkyCarWheelRearLeft 137 | 3300054: SkyCarWheelRearRight 138 | 3300056: SkyCarParts_MeshPart0 139 | 3300058: SkyCarParts_MeshPart1 140 | 3300060: SkyCarBody 141 | 3300062: SkyCarComponents 142 | 4300000: vehicle_skyCar_wheel_rearLeft 143 | 4300002: vehicle_skyCar_wheel_rearRight 144 | 4300004: vehicle_skyCar_underside 145 | 4300006: vehicle_skyCar_mudGuard_frontLeft 146 | 4300008: vehicle_skyCar_suspension_frontLeft 147 | 4300010: vehicle_skyCar_suspension_frontRight 148 | 4300012: vehicle_skyCar_mudGuard_frontRight 149 | 4300014: vehicle_skyCar_body_paintwork 150 | 4300016: vehicle_skyCar_wheel_frontRight 151 | 4300018: vehicle_skyCar_wheel_frontLeft 152 | 4300020: vehicle_skyCar_body_parts 153 | 4300022: vehicle_skyCar_brakeLights 154 | 4300024: vehicle_skyCar_headLights 155 | 4300026: vehicle_skyCar_brakeLights_glow 156 | 4300028: vehicle_skyCar_headLights_glow 157 | 4300030: SkyCarWheelRearLeft 158 | 4300032: SkyCarWheelRearRight 159 | 4300034: SkyCarUndercarriage 160 | 4300036: SkyCarMudGuardFrontLeft 161 | 4300038: SkyCarSuspensionFrontLeft 162 | 4300040: SkyCarSuspensionFrontRight 163 | 4300042: SkyCarMudGuardFrontRight 164 | 4300044: SkyCarBodyPaintwork 165 | 4300046: SkyCarWheelFrontRight 166 | 4300048: SkyCarWheelFrontLeft 167 | 4300050: SkyCarBodyParts 168 | 4300052: SkyCarBrakeLightsGlow 169 | 4300054: SkyCarHeadLightsGlow 170 | 4300056: SkyCarParts_MeshPart0 171 | 4300058: SkyCarParts_MeshPart1 172 | 4300060: SkyCarComponents 173 | 4300062: SkyCarBody 174 | 9500000: //RootNode 175 | materials: 176 | importMaterials: 1 177 | materialName: 1 178 | materialSearch: 2 179 | animations: 180 | legacyGenerateAnimations: 4 181 | bakeSimulation: 0 182 | resampleCurves: 1 183 | optimizeGameObjects: 0 184 | motionNodeName: 185 | animationImportErrors: 186 | animationImportWarnings: 187 | animationRetargetingWarnings: 188 | animationDoRetargetingWarnings: 0 189 | animationCompression: 1 190 | animationRotationError: 0.5 191 | animationPositionError: 0.5 192 | animationScaleError: 0.5 193 | animationWrapMode: 0 194 | extraExposedTransformPaths: [] 195 | clipAnimations: [] 196 | isReadable: 1 197 | meshes: 198 | lODScreenPercentages: [] 199 | globalScale: 0.01 200 | meshCompression: 0 201 | addColliders: 0 202 | importBlendShapes: 1 203 | swapUVChannels: 0 204 | generateSecondaryUV: 0 205 | useFileUnits: 0 206 | optimizeMeshForGPU: 0 207 | keepQuads: 0 208 | weldVertices: 1 209 | secondaryUVAngleDistortion: 8 210 | secondaryUVAreaDistortion: 15.000001 211 | secondaryUVHardAngle: 88 212 | secondaryUVPackMargin: 4 213 | useFileScale: 0 214 | tangentSpace: 215 | normalSmoothAngle: 60 216 | normalImportMode: 0 217 | tangentImportMode: 3 218 | importAnimation: 1 219 | copyAvatar: 0 220 | humanDescription: 221 | human: [] 222 | skeleton: [] 223 | armTwist: 0.5 224 | foreArmTwist: 0.5 225 | upperLegTwist: 0.5 226 | legTwist: 0.5 227 | armStretch: 0.05 228 | legStretch: 0.05 229 | feetSpacing: 0 230 | rootMotionBoneName: 231 | hasTranslationDoF: 0 232 | lastHumanDescriptionAvatarSource: {instanceID: 0} 233 | animationType: 0 234 | humanoidOversampling: 1 235 | additionalBone: 0 236 | userData: 237 | assetBundleName: 238 | assetBundleVariant: 239 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a04dfe54a44d18b459019efb35bdf808 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/CarController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Vehicles.Car 5 | { 6 | internal enum CarDriveType 7 | { 8 | FrontWheelDrive, 9 | RearWheelDrive, 10 | FourWheelDrive 11 | } 12 | 13 | internal enum SpeedType 14 | { 15 | MPH, 16 | KPH 17 | } 18 | 19 | public class CarController : MonoBehaviour 20 | { 21 | [SerializeField] private CarDriveType m_CarDriveType = CarDriveType.FourWheelDrive; 22 | [SerializeField] private WheelCollider[] m_WheelColliders = new WheelCollider[4]; 23 | [SerializeField] private GameObject[] m_WheelMeshes = new GameObject[4]; 24 | [SerializeField] private Vector3 m_CentreOfMassOffset; 25 | [SerializeField] private float m_MaximumSteerAngle; 26 | [Range(0, 1)] [SerializeField] private float m_SteerHelper; // 0 is raw physics , 1 the car will grip in the direction it is facing 27 | [Range(0, 1)] [SerializeField] private float m_TractionControl; // 0 is no traction control, 1 is full interference 28 | [SerializeField] private float m_FullTorqueOverAllWheels; 29 | [SerializeField] private float m_ReverseTorque; 30 | [SerializeField] private float m_MaxHandbrakeTorque; 31 | [SerializeField] private float m_Downforce = 100f; 32 | [SerializeField] private SpeedType m_SpeedType; 33 | [SerializeField] private float m_Topspeed = 200; 34 | [SerializeField] private static int NoOfGears = 5; 35 | [SerializeField] private float m_RevRangeBoundary = 1f; 36 | [SerializeField] private float m_SlipLimit; 37 | [SerializeField] private float m_BrakeTorque; 38 | 39 | private Quaternion[] m_WheelMeshLocalRotations; 40 | private Vector3 m_Prevpos, m_Pos; 41 | private float m_SteerAngle; 42 | private int m_GearNum; 43 | private float m_GearFactor; 44 | private float m_OldRotation; 45 | private float m_CurrentTorque; 46 | private Rigidbody m_Rigidbody; 47 | private const float k_ReversingThreshold = 0.01f; 48 | 49 | public bool Skidding { get; private set; } 50 | public float BrakeInput { get; private set; } 51 | public float CurrentSteerAngle{ get { return m_SteerAngle; }} 52 | public float CurrentSpeed{ get { return m_Rigidbody.velocity.magnitude*2.23693629f; }} 53 | public float MaxSpeed{get { return m_Topspeed; }} 54 | public float Revs { get; private set; } 55 | public float AccelInput { get; private set; } 56 | 57 | // Use this for initialization 58 | private void Start() 59 | { 60 | m_WheelMeshLocalRotations = new Quaternion[4]; 61 | for (int i = 0; i < 4; i++) 62 | { 63 | m_WheelMeshLocalRotations[i] = m_WheelMeshes[i].transform.localRotation; 64 | } 65 | m_WheelColliders[0].attachedRigidbody.centerOfMass = m_CentreOfMassOffset; 66 | 67 | m_MaxHandbrakeTorque = float.MaxValue; 68 | 69 | m_Rigidbody = GetComponent(); 70 | m_CurrentTorque = m_FullTorqueOverAllWheels - (m_TractionControl*m_FullTorqueOverAllWheels); 71 | } 72 | 73 | 74 | private void GearChanging() 75 | { 76 | float f = Mathf.Abs(CurrentSpeed/MaxSpeed); 77 | float upgearlimit = (1/(float) NoOfGears)*(m_GearNum + 1); 78 | float downgearlimit = (1/(float) NoOfGears)*m_GearNum; 79 | 80 | if (m_GearNum > 0 && f < downgearlimit) 81 | { 82 | m_GearNum--; 83 | } 84 | 85 | if (f > upgearlimit && (m_GearNum < (NoOfGears - 1))) 86 | { 87 | m_GearNum++; 88 | } 89 | } 90 | 91 | 92 | // simple function to add a curved bias towards 1 for a value in the 0-1 range 93 | private static float CurveFactor(float factor) 94 | { 95 | return 1 - (1 - factor)*(1 - factor); 96 | } 97 | 98 | 99 | // unclamped version of Lerp, to allow value to exceed the from-to range 100 | private static float ULerp(float from, float to, float value) 101 | { 102 | return (1.0f - value)*from + value*to; 103 | } 104 | 105 | 106 | private void CalculateGearFactor() 107 | { 108 | float f = (1/(float) NoOfGears); 109 | // gear factor is a normalised representation of the current speed within the current gear's range of speeds. 110 | // We smooth towards the 'target' gear factor, so that revs don't instantly snap up or down when changing gear. 111 | var targetGearFactor = Mathf.InverseLerp(f*m_GearNum, f*(m_GearNum + 1), Mathf.Abs(CurrentSpeed/MaxSpeed)); 112 | m_GearFactor = Mathf.Lerp(m_GearFactor, targetGearFactor, Time.deltaTime*5f); 113 | } 114 | 115 | 116 | private void CalculateRevs() 117 | { 118 | // calculate engine revs (for display / sound) 119 | // (this is done in retrospect - revs are not used in force/power calculations) 120 | CalculateGearFactor(); 121 | var gearNumFactor = m_GearNum/(float) NoOfGears; 122 | var revsRangeMin = ULerp(0f, m_RevRangeBoundary, CurveFactor(gearNumFactor)); 123 | var revsRangeMax = ULerp(m_RevRangeBoundary, 1f, gearNumFactor); 124 | Revs = ULerp(revsRangeMin, revsRangeMax, m_GearFactor); 125 | } 126 | 127 | 128 | public void Move(float steering, float accel, float footbrake, float handbrake) 129 | { 130 | for (int i = 0; i < 4; i++) 131 | { 132 | Quaternion quat; 133 | Vector3 position; 134 | m_WheelColliders[i].GetWorldPose(out position, out quat); 135 | m_WheelMeshes[i].transform.position = position; 136 | m_WheelMeshes[i].transform.rotation = quat; 137 | } 138 | 139 | //clamp input values 140 | steering = Mathf.Clamp(steering, -1, 1); 141 | AccelInput = accel = Mathf.Clamp(accel, 0, 1); 142 | BrakeInput = footbrake = -1*Mathf.Clamp(footbrake, -1, 0); 143 | handbrake = Mathf.Clamp(handbrake, 0, 1); 144 | 145 | //Set the steer on the front wheels. 146 | //Assuming that wheels 0 and 1 are the front wheels. 147 | m_SteerAngle = steering*m_MaximumSteerAngle; 148 | m_WheelColliders[0].steerAngle = m_SteerAngle; 149 | m_WheelColliders[1].steerAngle = m_SteerAngle; 150 | 151 | SteerHelper(); 152 | ApplyDrive(accel, footbrake); 153 | CapSpeed(); 154 | 155 | //Set the handbrake. 156 | //Assuming that wheels 2 and 3 are the rear wheels. 157 | if (handbrake > 0f) 158 | { 159 | var hbTorque = handbrake*m_MaxHandbrakeTorque; 160 | m_WheelColliders[2].brakeTorque = hbTorque; 161 | m_WheelColliders[3].brakeTorque = hbTorque; 162 | } 163 | 164 | 165 | CalculateRevs(); 166 | GearChanging(); 167 | 168 | AddDownForce(); 169 | TractionControl(); 170 | } 171 | 172 | 173 | private void CapSpeed() 174 | { 175 | float speed = m_Rigidbody.velocity.magnitude; 176 | switch (m_SpeedType) 177 | { 178 | case SpeedType.MPH: 179 | 180 | speed *= 2.23693629f; 181 | if (speed > m_Topspeed) 182 | m_Rigidbody.velocity = (m_Topspeed/2.23693629f) * m_Rigidbody.velocity.normalized; 183 | break; 184 | 185 | case SpeedType.KPH: 186 | speed *= 3.6f; 187 | if (speed > m_Topspeed) 188 | m_Rigidbody.velocity = (m_Topspeed/3.6f) * m_Rigidbody.velocity.normalized; 189 | break; 190 | } 191 | } 192 | 193 | 194 | private void ApplyDrive(float accel, float footbrake) 195 | { 196 | 197 | float thrustTorque; 198 | switch (m_CarDriveType) 199 | { 200 | case CarDriveType.FourWheelDrive: 201 | thrustTorque = accel * (m_CurrentTorque / 4f); 202 | for (int i = 0; i < 4; i++) 203 | { 204 | m_WheelColliders[i].motorTorque = thrustTorque; 205 | } 206 | break; 207 | 208 | case CarDriveType.FrontWheelDrive: 209 | thrustTorque = accel * (m_CurrentTorque / 2f); 210 | m_WheelColliders[0].motorTorque = m_WheelColliders[1].motorTorque = thrustTorque; 211 | break; 212 | 213 | case CarDriveType.RearWheelDrive: 214 | thrustTorque = accel * (m_CurrentTorque / 2f); 215 | m_WheelColliders[2].motorTorque = m_WheelColliders[3].motorTorque = thrustTorque; 216 | break; 217 | 218 | } 219 | 220 | for (int i = 0; i < 4; i++) 221 | { 222 | if (CurrentSpeed > 5 && Vector3.Angle(transform.forward, m_Rigidbody.velocity) < 50f) 223 | { 224 | m_WheelColliders[i].brakeTorque = m_BrakeTorque*footbrake; 225 | } 226 | else if (footbrake > 0) 227 | { 228 | m_WheelColliders[i].brakeTorque = 0f; 229 | m_WheelColliders[i].motorTorque = -m_ReverseTorque*footbrake; 230 | } 231 | } 232 | } 233 | 234 | 235 | private void SteerHelper() 236 | { 237 | for (int i = 0; i < 4; i++) 238 | { 239 | WheelHit wheelhit; 240 | m_WheelColliders[i].GetGroundHit(out wheelhit); 241 | if (wheelhit.normal == Vector3.zero) 242 | return; // wheels arent on the ground so dont realign the rigidbody velocity 243 | } 244 | 245 | // this if is needed to avoid gimbal lock problems that will make the car suddenly shift direction 246 | if (Mathf.Abs(m_OldRotation - transform.eulerAngles.y) < 10f) 247 | { 248 | var turnadjust = (transform.eulerAngles.y - m_OldRotation) * m_SteerHelper; 249 | Quaternion velRotation = Quaternion.AngleAxis(turnadjust, Vector3.up); 250 | m_Rigidbody.velocity = velRotation * m_Rigidbody.velocity; 251 | } 252 | m_OldRotation = transform.eulerAngles.y; 253 | } 254 | 255 | 256 | // this is used to add more grip in relation to speed 257 | private void AddDownForce() 258 | { 259 | m_WheelColliders[0].attachedRigidbody.AddForce(-transform.up*m_Downforce* 260 | m_WheelColliders[0].attachedRigidbody.velocity.magnitude); 261 | } 262 | 263 | // crude traction control that reduces the power to wheel if the car is wheel spinning too much 264 | private void TractionControl() 265 | { 266 | WheelHit wheelHit; 267 | switch (m_CarDriveType) 268 | { 269 | case CarDriveType.FourWheelDrive: 270 | // loop through all wheels 271 | for (int i = 0; i < 4; i++) 272 | { 273 | m_WheelColliders[i].GetGroundHit(out wheelHit); 274 | 275 | AdjustTorque(wheelHit.forwardSlip); 276 | } 277 | break; 278 | 279 | case CarDriveType.RearWheelDrive: 280 | m_WheelColliders[2].GetGroundHit(out wheelHit); 281 | AdjustTorque(wheelHit.forwardSlip); 282 | 283 | m_WheelColliders[3].GetGroundHit(out wheelHit); 284 | AdjustTorque(wheelHit.forwardSlip); 285 | break; 286 | 287 | case CarDriveType.FrontWheelDrive: 288 | m_WheelColliders[0].GetGroundHit(out wheelHit); 289 | AdjustTorque(wheelHit.forwardSlip); 290 | 291 | m_WheelColliders[1].GetGroundHit(out wheelHit); 292 | AdjustTorque(wheelHit.forwardSlip); 293 | break; 294 | } 295 | } 296 | 297 | 298 | private void AdjustTorque(float forwardSlip) 299 | { 300 | if (forwardSlip >= m_SlipLimit && m_CurrentTorque >= 0) 301 | { 302 | m_CurrentTorque -= 10 * m_TractionControl; 303 | } 304 | else 305 | { 306 | m_CurrentTorque += 10 * m_TractionControl; 307 | if (m_CurrentTorque > m_FullTorqueOverAllWheels) 308 | { 309 | m_CurrentTorque = m_FullTorqueOverAllWheels; 310 | } 311 | } 312 | } 313 | } 314 | } 315 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/CarController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ea65b38d485c374caa584a03f1de571 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/CarSelfRighting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Vehicles.Car 5 | { 6 | public class CarSelfRighting : MonoBehaviour 7 | { 8 | // Automatically put the car the right way up, if it has come to rest upside-down. 9 | [SerializeField] private float m_WaitTime = 3f; // time to wait before self righting 10 | [SerializeField] private float m_VelocityThreshold = 1f; // the velocity below which the car is considered stationary for self-righting 11 | 12 | private float m_LastOkTime; // the last time that the car was in an OK state 13 | private Rigidbody m_Rigidbody; 14 | 15 | 16 | private void Start() 17 | { 18 | m_Rigidbody = GetComponent(); 19 | } 20 | 21 | 22 | private void Update() 23 | { 24 | // is the car is the right way up 25 | if (transform.up.y > 0f || m_Rigidbody.velocity.magnitude > m_VelocityThreshold) 26 | { 27 | m_LastOkTime = Time.time; 28 | } 29 | 30 | if (Time.time > m_LastOkTime + m_WaitTime) 31 | { 32 | RightCar(); 33 | } 34 | } 35 | 36 | 37 | // put the car back the right way up: 38 | private void RightCar() 39 | { 40 | // set the correct orientation for the car, and lift it off the ground a little 41 | transform.position += Vector3.up; 42 | transform.rotation = Quaternion.LookRotation(transform.forward); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/CarSelfRighting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9db865986f75ee44eba89ace4646af65 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/CarUserControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Vehicles.Car 5 | { 6 | [RequireComponent(typeof (CarController))] 7 | public class CarUserControl : MonoBehaviour 8 | { 9 | private CarController m_Car; // the car controller we want to use 10 | 11 | 12 | private void Awake() 13 | { 14 | // get the car controller 15 | m_Car = GetComponent(); 16 | } 17 | 18 | 19 | private void FixedUpdate() 20 | { 21 | // pass the input to the car! 22 | float h = Input.GetAxis("Horizontal"); 23 | float v = Input.GetAxis("Vertical"); 24 | #if !MOBILE_INPUT 25 | float handbrake = Input.GetAxis("Jump"); 26 | m_Car.Move(h, v, v, handbrake); 27 | #else 28 | m_Car.Move(h, v, v, 0f); 29 | #endif 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/CarUserControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96468c245ae8e0d4f8f1c7a7b8b0542e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/Mudguard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Vehicles.Car 5 | { 6 | // this script is specific to the supplied Sample Assets car, which has mudguards over the front wheels 7 | // which have to turn with the wheels when steering is applied. 8 | 9 | public class Mudguard : MonoBehaviour 10 | { 11 | public CarController carController; // car controller to get the steering angle 12 | 13 | private Quaternion m_OriginalRotation; 14 | 15 | 16 | private void Start() 17 | { 18 | m_OriginalRotation = transform.localRotation; 19 | } 20 | 21 | 22 | private void Update() 23 | { 24 | transform.localRotation = m_OriginalRotation*Quaternion.Euler(0, carController.CurrentSteerAngle, 0); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/Mudguard.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 459cec5b068041e44a60a6e3b6abb0eb 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/Suspension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.Vehicles.Car 5 | { 6 | // this script is specific to the car supplied in the the assets 7 | // it controls the suspension hub to make it move with the wheel are it goes over bumps 8 | public class Suspension : MonoBehaviour 9 | { 10 | public GameObject wheel; // The wheel that the script needs to referencing to get the postion for the suspension 11 | 12 | 13 | private Vector3 m_TargetOriginalPosition; 14 | private Vector3 m_Origin; 15 | 16 | 17 | private void Start() 18 | { 19 | m_TargetOriginalPosition = wheel.transform.localPosition; 20 | m_Origin = transform.localPosition; 21 | } 22 | 23 | 24 | private void Update() 25 | { 26 | transform.localPosition = m_Origin + (wheel.transform.localPosition - m_TargetOriginalPosition); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Scripts/Suspension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ec1e45165d1f2544bff59f5a80db8ab 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 804ac3ddb444bfe4ab70ff4f4b84ce70 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarBodyNormals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Textures/SkyCarBodyNormals.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarBodyNormals.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4ffb7d0ebee510498fba9d50f2296f7 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 1 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 1 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 2 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | spriteTessellationDetail: -1 48 | textureType: 1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | outline: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarBodyOcclusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Textures/SkyCarBodyOcclusion.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarBodyOcclusion.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd0d469704e7c934ebddc45ece4c1868 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 2 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: 0 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 2 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | spriteTessellationDetail: -1 48 | textureType: 0 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | outline: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarLightsGlowAlpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Textures/SkyCarLightsGlowAlpha.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarLightsGlowAlpha.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fc19647dd174e04e9793be879aea216 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaIsTransparency: 0 46 | textureType: -1 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarWheelNormals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Textures/SkyCarWheelNormals.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarWheelNormals.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af58420b18450884782f4761c8f71952 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 1 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 1 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 2 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | spriteTessellationDetail: -1 48 | textureType: 1 49 | buildTargetSettings: 50 | - buildTarget: iPhone 51 | maxTextureSize: 512 52 | textureFormat: -1 53 | compressionQuality: 50 54 | allowsAlphaSplitting: 0 55 | - buildTarget: Android 56 | maxTextureSize: 512 57 | textureFormat: -1 58 | compressionQuality: 50 59 | allowsAlphaSplitting: 0 60 | - buildTarget: BlackBerry 61 | maxTextureSize: 512 62 | textureFormat: -1 63 | compressionQuality: 50 64 | allowsAlphaSplitting: 0 65 | - buildTarget: WP8 66 | maxTextureSize: 512 67 | textureFormat: -1 68 | compressionQuality: 50 69 | allowsAlphaSplitting: 0 70 | spriteSheet: 71 | sprites: [] 72 | outline: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarWheelOcclusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/Standard Assets/Vehicles/Car/Textures/SkyCarWheelOcclusion.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Vehicles/Car/Textures/SkyCarWheelOcclusion.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9486e5d1d37e86246b9bd1e314a8a721 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 2 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | spriteTessellationDetail: -1 48 | textureType: -1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | outline: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9881505acdda10e4eaf56179b7edcb45 3 | folderAsset: yes 4 | timeCreated: 1494406329 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/Skidmarks.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | // Skidmarks controller. Put one of these in a scene somewhere. Call AddSkidMark. 5 | // Copyright 2017 Nition, BSD licence (see LICENCE file). http://nition.co 6 | public class Skidmarks : MonoBehaviour { 7 | // INSPECTOR SETTINGS 8 | 9 | [SerializeField] 10 | Material skidmarksMaterial; // Material for the skidmarks to use 11 | 12 | // END INSPECTOR SETTINGS 13 | 14 | const int MAX_MARKS = 2048; // Max number of marks total for everyone together 15 | const float MARK_WIDTH = 0.35f; // Width of the skidmarks. Should match the width of the wheels 16 | const float GROUND_OFFSET = 0.02f; // Distance above surface in metres 17 | const float MIN_DISTANCE = 0.25f; // Distance between skid texture sections in metres. Bigger = better performance, less smooth 18 | const float MIN_SQR_DISTANCE = MIN_DISTANCE * MIN_DISTANCE; 19 | const float MAX_OPACITY = 1.0f; // Max skidmark opacity 20 | 21 | // Info for each mark created. Needed to generate the correct mesh 22 | class MarkSection { 23 | public Vector3 Pos = Vector3.zero; 24 | public Vector3 Normal = Vector3.zero; 25 | public Vector4 Tangent = Vector4.zero; 26 | public Vector3 Posl = Vector3.zero; 27 | public Vector3 Posr = Vector3.zero; 28 | public Color32 Colour; 29 | public int LastIndex; 30 | }; 31 | 32 | int markIndex; 33 | MarkSection[] skidmarks; 34 | Mesh marksMesh; 35 | MeshRenderer mr; 36 | MeshFilter mf; 37 | 38 | Vector3[] vertices; 39 | Vector3[] normals; 40 | Vector4[] tangents; 41 | Color32[] colors; 42 | Vector2[] uvs; 43 | int[] triangles; 44 | 45 | bool meshUpdated; 46 | bool haveSetBounds; 47 | 48 | Color32 black = Color.black; 49 | 50 | // #### UNITY INTERNAL METHODS #### 51 | 52 | protected void Awake() { 53 | if (transform.position != Vector3.zero) { 54 | Debug.LogWarning("Skidmarks.cs transform must be at 0,0,0. Setting it to zero now."); 55 | transform.position = Vector3.zero; 56 | transform.rotation = Quaternion.identity; 57 | } 58 | } 59 | 60 | protected void Start() { 61 | // Generate a fixed array of skidmarks 62 | skidmarks = new MarkSection[MAX_MARKS]; 63 | for (int i = 0; i < MAX_MARKS; i++) { 64 | skidmarks[i] = new MarkSection(); 65 | } 66 | 67 | mf = GetComponent(); 68 | mr = GetComponent(); 69 | if (mr == null) { 70 | mr = gameObject.AddComponent(); 71 | } 72 | 73 | marksMesh = new Mesh(); 74 | marksMesh.MarkDynamic(); 75 | if (mf == null) { 76 | mf = gameObject.AddComponent(); 77 | } 78 | mf.sharedMesh = marksMesh; 79 | 80 | vertices = new Vector3[MAX_MARKS * 4]; 81 | normals = new Vector3[MAX_MARKS * 4]; 82 | tangents = new Vector4[MAX_MARKS * 4]; 83 | colors = new Color32[MAX_MARKS * 4]; 84 | uvs = new Vector2[MAX_MARKS * 4]; 85 | triangles = new int[MAX_MARKS * 6]; 86 | 87 | mr.shadowCastingMode = ShadowCastingMode.Off; 88 | mr.receiveShadows = false; 89 | mr.material = skidmarksMaterial; 90 | mr.lightProbeUsage = LightProbeUsage.Off; 91 | } 92 | 93 | protected void LateUpdate() { 94 | if (!meshUpdated) return; 95 | meshUpdated = false; 96 | 97 | // Reassign the mesh if it's changed this frame 98 | marksMesh.vertices = vertices; 99 | marksMesh.normals = normals; 100 | marksMesh.tangents = tangents; 101 | marksMesh.triangles = triangles; 102 | marksMesh.colors32 = colors; 103 | marksMesh.uv = uvs; 104 | 105 | if (!haveSetBounds) { 106 | // Could use RecalculateBounds here each frame instead, but it uses about 0.1-0.2ms each time 107 | // Save time by just making the mesh bounds huge, so the skidmarks will always draw 108 | // Not sure why I only need to do this once, yet can't do it in Start (it resets to zero) 109 | marksMesh.bounds = new Bounds(new Vector3(0, 0, 0), new Vector3(10000, 10000, 10000)); 110 | haveSetBounds = true; 111 | } 112 | 113 | mf.sharedMesh = marksMesh; 114 | } 115 | 116 | // #### PUBLIC METHODS #### 117 | 118 | // Function called by the wheel that's skidding. Sets the intensity of the skidmark section, in the default black. 119 | public int AddSkidMark(Vector3 pos, Vector3 normal, float opacity, int lastIndex) { 120 | if (opacity > 1) opacity = 1.0f; 121 | else if (opacity < 0) return -1; 122 | 123 | black.a = (byte)(opacity * 255); 124 | return AddSkidMark(pos, normal, black, lastIndex); 125 | } 126 | 127 | // Function called by the wheel that's skidding. Sets the colour and intensity of the skidmark section. 128 | public int AddSkidMark(Vector3 pos, Vector3 normal, Color32 colour, int lastIndex) { 129 | if (colour.a == 0) return -1; // No point in continuing if it's invisible 130 | 131 | MarkSection lastSection = null; 132 | Vector3 distAndDirection = Vector3.zero; 133 | Vector3 newPos = pos + normal * GROUND_OFFSET; 134 | if (lastIndex != -1) { 135 | lastSection = skidmarks[lastIndex]; 136 | distAndDirection = newPos - lastSection.Pos; 137 | if (distAndDirection.sqrMagnitude < MIN_SQR_DISTANCE) { 138 | return lastIndex; 139 | } 140 | // Fixes an awkward bug: 141 | // - Car draws skidmark, e.g. index 50 with last index 40. 142 | // - Skidmark markIndex loops around, and other car overwrites index 50 143 | // - Car draws skidmark, e.g. index 45. Last index was 40, but now 40 is different, changed by someone else. 144 | // This makes sure we ignore the last index if the distance looks wrong 145 | if (distAndDirection.sqrMagnitude > MIN_SQR_DISTANCE * 10) { 146 | lastIndex = -1; 147 | lastSection = null; 148 | } 149 | } 150 | 151 | colour.a = (byte)(colour.a * MAX_OPACITY); 152 | 153 | MarkSection curSection = skidmarks[markIndex]; 154 | 155 | curSection.Pos = newPos; 156 | curSection.Normal = normal; 157 | curSection.Colour = colour; 158 | curSection.LastIndex = lastIndex; 159 | 160 | if (lastSection != null) { 161 | Vector3 xDirection = Vector3.Cross(distAndDirection, normal).normalized; 162 | curSection.Posl = curSection.Pos + xDirection * MARK_WIDTH * 0.5f; 163 | curSection.Posr = curSection.Pos - xDirection * MARK_WIDTH * 0.5f; 164 | curSection.Tangent = new Vector4(xDirection.x, xDirection.y, xDirection.z, 1); 165 | 166 | if (lastSection.LastIndex == -1) { 167 | lastSection.Tangent = curSection.Tangent; 168 | lastSection.Posl = curSection.Pos + xDirection * MARK_WIDTH * 0.5f; 169 | lastSection.Posr = curSection.Pos - xDirection * MARK_WIDTH * 0.5f; 170 | } 171 | } 172 | 173 | UpdateSkidmarksMesh(); 174 | 175 | int curIndex = markIndex; 176 | if (lastIndex == -1) { 177 | markIndex = (markIndex - 1 + MAX_MARKS) % MAX_MARKS; 178 | } 179 | else { 180 | markIndex = ++markIndex % MAX_MARKS; 181 | } 182 | return curIndex; 183 | } 184 | 185 | // #### PROTECTED/PRIVATE METHODS #### 186 | 187 | // Update part of the mesh for the current markIndex 188 | void UpdateSkidmarksMesh() { 189 | MarkSection curr = skidmarks[markIndex]; 190 | 191 | // Nothing to connect to yet 192 | if (curr.LastIndex == -1) return; 193 | 194 | MarkSection last = skidmarks[curr.LastIndex]; 195 | vertices[markIndex * 4 + 0] = last.Posl; 196 | vertices[markIndex * 4 + 1] = last.Posr; 197 | vertices[markIndex * 4 + 2] = curr.Posl; 198 | vertices[markIndex * 4 + 3] = curr.Posr; 199 | 200 | normals[markIndex * 4 + 0] = last.Normal; 201 | normals[markIndex * 4 + 1] = last.Normal; 202 | normals[markIndex * 4 + 2] = curr.Normal; 203 | normals[markIndex * 4 + 3] = curr.Normal; 204 | 205 | tangents[markIndex * 4 + 0] = last.Tangent; 206 | tangents[markIndex * 4 + 1] = last.Tangent; 207 | tangents[markIndex * 4 + 2] = curr.Tangent; 208 | tangents[markIndex * 4 + 3] = curr.Tangent; 209 | 210 | colors[markIndex * 4 + 0] = last.Colour; 211 | colors[markIndex * 4 + 1] = last.Colour; 212 | colors[markIndex * 4 + 2] = curr.Colour; 213 | colors[markIndex * 4 + 3] = curr.Colour; 214 | 215 | uvs[markIndex * 4 + 0] = new Vector2(0, 0); 216 | uvs[markIndex * 4 + 1] = new Vector2(1, 0); 217 | uvs[markIndex * 4 + 2] = new Vector2(0, 1); 218 | uvs[markIndex * 4 + 3] = new Vector2(1, 1); 219 | 220 | triangles[markIndex * 6 + 0] = markIndex * 4 + 0; 221 | triangles[markIndex * 6 + 2] = markIndex * 4 + 1; 222 | triangles[markIndex * 6 + 1] = markIndex * 4 + 2; 223 | 224 | triangles[markIndex * 6 + 3] = markIndex * 4 + 2; 225 | triangles[markIndex * 6 + 5] = markIndex * 4 + 1; 226 | triangles[markIndex * 6 + 4] = markIndex * 4 + 3; 227 | 228 | meshUpdated = true; 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/Skidmarks.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8a0bddfb97fbfb4da04ef8e02113173 3 | timeCreated: 1494406354 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/Skidmarks.shader: -------------------------------------------------------------------------------- 1 | Shader "Skidmarks" { 2 | Properties { 3 | _Color("Main Color", Color) = (1,1,1,1) 4 | _MainTex("Base (RGB) Trans (A)", 2D) = "white" {} 5 | } 6 | 7 | Category { 8 | Offset -4, -4 9 | ZWrite Off 10 | Alphatest Greater 0 11 | Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" } 12 | 13 | SubShader{ 14 | ColorMaterial AmbientAndDiffuse 15 | Lighting Off 16 | Blend SrcAlpha OneMinusSrcAlpha 17 | Pass{ 18 | ColorMask RGBA 19 | SetTexture[_MainTex]{ 20 | Combine texture, texture * primary 21 | } 22 | SetTexture[_MainTex]{ 23 | Combine primary * previous 24 | } 25 | } 26 | } 27 | } 28 | 29 | // Fallback to Alpha Vertex Lit 30 | Fallback "Transparent/VertexLit", 2 31 | 32 | } -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/Skidmarks.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 748797bf246665248b65ec17e29bd275 3 | timeCreated: 1494406678 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/SkidmarksMat.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/UnitySkidmarks/SkidmarksMat.mat -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/SkidmarksMat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c4fa5f647c3046469d1868c47f3130f 3 | timeCreated: 1494406622 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/SkidmarksTex.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/Assets/UnitySkidmarks/SkidmarksTex.psd -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/SkidmarksTex.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26034eb97365ff443a07e333666652de 3 | timeCreated: 1494406348 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 1 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/WheelSkid.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | // Example skid script. Put this on a WheelCollider. 6 | // Copyright 2017 Nition, BSD licence (see LICENCE file). http://nition.co 7 | [RequireComponent(typeof(WheelCollider))] 8 | public class WheelSkid : MonoBehaviour { 9 | 10 | // INSPECTOR SETTINGS 11 | 12 | [SerializeField] 13 | Rigidbody rb; 14 | [SerializeField] 15 | Skidmarks skidmarksController; 16 | 17 | // END INSPECTOR SETTINGS 18 | 19 | WheelCollider wheelCollider; 20 | WheelHit wheelHitInfo; 21 | 22 | const float SKID_FX_SPEED = 0.5f; // Min side slip speed in m/s to start showing a skid 23 | const float MAX_SKID_INTENSITY = 20.0f; // m/s where skid opacity is at full intensity 24 | const float WHEEL_SLIP_MULTIPLIER = 10.0f; // For wheelspin. Adjust how much skids show 25 | int lastSkid = -1; // Array index for the skidmarks controller. Index of last skidmark piece this wheel used 26 | float lastFixedUpdateTime; 27 | 28 | // #### UNITY INTERNAL METHODS #### 29 | 30 | protected void Awake() { 31 | wheelCollider = GetComponent(); 32 | lastFixedUpdateTime = Time.time; 33 | } 34 | 35 | protected void FixedUpdate() { 36 | lastFixedUpdateTime = Time.time; 37 | } 38 | 39 | protected void LateUpdate() { 40 | if (wheelCollider.GetGroundHit(out wheelHitInfo)) 41 | { 42 | // Check sideways speed 43 | 44 | // Gives velocity with +z being the car's forward axis 45 | Vector3 localVelocity = transform.InverseTransformDirection(rb.velocity); 46 | float skidTotal = Mathf.Abs(localVelocity.x); 47 | 48 | // Check wheel spin as well 49 | 50 | float wheelAngularVelocity = wheelCollider.radius * ((2 * Mathf.PI * wheelCollider.rpm) / 60); 51 | float carForwardVel = Vector3.Dot(rb.velocity, transform.forward); 52 | float wheelSpin = Mathf.Abs(carForwardVel - wheelAngularVelocity) * WHEEL_SLIP_MULTIPLIER; 53 | 54 | // NOTE: This extra line should not be needed and you can take it out if you have decent wheel physics 55 | // The built-in Unity demo car is actually skidding its wheels the ENTIRE time you're accelerating, 56 | // so this fades out the wheelspin-based skid as speed increases to make it look almost OK 57 | wheelSpin = Mathf.Max(0, wheelSpin * (10 - Mathf.Abs(carForwardVel))); 58 | 59 | skidTotal += wheelSpin; 60 | 61 | // Skid if we should 62 | if (skidTotal >= SKID_FX_SPEED) { 63 | float intensity = Mathf.Clamp01(skidTotal / MAX_SKID_INTENSITY); 64 | // Account for further movement since the last FixedUpdate 65 | Vector3 skidPoint = wheelHitInfo.point + (rb.velocity * (Time.time - lastFixedUpdateTime)); 66 | lastSkid = skidmarksController.AddSkidMark(skidPoint, wheelHitInfo.normal, intensity, lastSkid); 67 | } 68 | else { 69 | lastSkid = -1; 70 | } 71 | } 72 | else { 73 | lastSkid = -1; 74 | } 75 | } 76 | 77 | // #### PUBLIC METHODS #### 78 | 79 | // #### PROTECTED/PRIVATE METHODS #### 80 | 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Assets/UnitySkidmarks/WheelSkid.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1848074eee38bc247a4f6de3aa81ca60 3 | timeCreated: 1494406399 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/csc.rsp: -------------------------------------------------------------------------------- 1 | -nowarn:0649 -------------------------------------------------------------------------------- /Assets/csc.rsp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5467f5186d9828d41b078e82e0f618eb 3 | timeCreated: 1484487853 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Nition 2 | https://github.com/Nition/UnitySkidmarks 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Logs/Packages-Update.log: -------------------------------------------------------------------------------- 1 | 2 | === Fri Jul 24 21:23:49 2020 3 | 4 | Packages were changed. 5 | Update Mode: updateDependencies 6 | 7 | The following packages were removed: 8 | com.unity.package-manager-ui@2.2.0 9 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.modules.ai": "1.0.0", 4 | "com.unity.modules.androidjni": "1.0.0", 5 | "com.unity.modules.animation": "1.0.0", 6 | "com.unity.modules.assetbundle": "1.0.0", 7 | "com.unity.modules.audio": "1.0.0", 8 | "com.unity.modules.cloth": "1.0.0", 9 | "com.unity.modules.director": "1.0.0", 10 | "com.unity.modules.imageconversion": "1.0.0", 11 | "com.unity.modules.imgui": "1.0.0", 12 | "com.unity.modules.jsonserialize": "1.0.0", 13 | "com.unity.modules.particlesystem": "1.0.0", 14 | "com.unity.modules.physics": "1.0.0", 15 | "com.unity.modules.physics2d": "1.0.0", 16 | "com.unity.modules.screencapture": "1.0.0", 17 | "com.unity.modules.terrain": "1.0.0", 18 | "com.unity.modules.terrainphysics": "1.0.0", 19 | "com.unity.modules.tilemap": "1.0.0", 20 | "com.unity.modules.ui": "1.0.0", 21 | "com.unity.modules.uielements": "1.0.0", 22 | "com.unity.modules.umbra": "1.0.0", 23 | "com.unity.modules.unityanalytics": "1.0.0", 24 | "com.unity.modules.unitywebrequest": "1.0.0", 25 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 26 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 27 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 28 | "com.unity.modules.unitywebrequestwww": "1.0.0", 29 | "com.unity.modules.vehicles": "1.0.0", 30 | "com.unity.modules.video": "1.0.0", 31 | "com.unity.modules.vr": "1.0.0", 32 | "com.unity.modules.wind": "1.0.0", 33 | "com.unity.modules.xr": "1.0.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.modules.ai": { 4 | "version": "1.0.0", 5 | "depth": 0, 6 | "source": "builtin", 7 | "dependencies": {} 8 | }, 9 | "com.unity.modules.androidjni": { 10 | "version": "1.0.0", 11 | "depth": 0, 12 | "source": "builtin", 13 | "dependencies": {} 14 | }, 15 | "com.unity.modules.animation": { 16 | "version": "1.0.0", 17 | "depth": 0, 18 | "source": "builtin", 19 | "dependencies": {} 20 | }, 21 | "com.unity.modules.assetbundle": { 22 | "version": "1.0.0", 23 | "depth": 0, 24 | "source": "builtin", 25 | "dependencies": {} 26 | }, 27 | "com.unity.modules.audio": { 28 | "version": "1.0.0", 29 | "depth": 0, 30 | "source": "builtin", 31 | "dependencies": {} 32 | }, 33 | "com.unity.modules.cloth": { 34 | "version": "1.0.0", 35 | "depth": 0, 36 | "source": "builtin", 37 | "dependencies": { 38 | "com.unity.modules.physics": "1.0.0" 39 | } 40 | }, 41 | "com.unity.modules.director": { 42 | "version": "1.0.0", 43 | "depth": 0, 44 | "source": "builtin", 45 | "dependencies": { 46 | "com.unity.modules.audio": "1.0.0", 47 | "com.unity.modules.animation": "1.0.0" 48 | } 49 | }, 50 | "com.unity.modules.imageconversion": { 51 | "version": "1.0.0", 52 | "depth": 0, 53 | "source": "builtin", 54 | "dependencies": {} 55 | }, 56 | "com.unity.modules.imgui": { 57 | "version": "1.0.0", 58 | "depth": 0, 59 | "source": "builtin", 60 | "dependencies": {} 61 | }, 62 | "com.unity.modules.jsonserialize": { 63 | "version": "1.0.0", 64 | "depth": 0, 65 | "source": "builtin", 66 | "dependencies": {} 67 | }, 68 | "com.unity.modules.particlesystem": { 69 | "version": "1.0.0", 70 | "depth": 0, 71 | "source": "builtin", 72 | "dependencies": {} 73 | }, 74 | "com.unity.modules.physics": { 75 | "version": "1.0.0", 76 | "depth": 0, 77 | "source": "builtin", 78 | "dependencies": {} 79 | }, 80 | "com.unity.modules.physics2d": { 81 | "version": "1.0.0", 82 | "depth": 0, 83 | "source": "builtin", 84 | "dependencies": {} 85 | }, 86 | "com.unity.modules.screencapture": { 87 | "version": "1.0.0", 88 | "depth": 0, 89 | "source": "builtin", 90 | "dependencies": { 91 | "com.unity.modules.imageconversion": "1.0.0" 92 | } 93 | }, 94 | "com.unity.modules.subsystems": { 95 | "version": "1.0.0", 96 | "depth": 1, 97 | "source": "builtin", 98 | "dependencies": { 99 | "com.unity.modules.jsonserialize": "1.0.0" 100 | } 101 | }, 102 | "com.unity.modules.terrain": { 103 | "version": "1.0.0", 104 | "depth": 0, 105 | "source": "builtin", 106 | "dependencies": {} 107 | }, 108 | "com.unity.modules.terrainphysics": { 109 | "version": "1.0.0", 110 | "depth": 0, 111 | "source": "builtin", 112 | "dependencies": { 113 | "com.unity.modules.physics": "1.0.0", 114 | "com.unity.modules.terrain": "1.0.0" 115 | } 116 | }, 117 | "com.unity.modules.tilemap": { 118 | "version": "1.0.0", 119 | "depth": 0, 120 | "source": "builtin", 121 | "dependencies": { 122 | "com.unity.modules.physics2d": "1.0.0" 123 | } 124 | }, 125 | "com.unity.modules.ui": { 126 | "version": "1.0.0", 127 | "depth": 0, 128 | "source": "builtin", 129 | "dependencies": {} 130 | }, 131 | "com.unity.modules.uielements": { 132 | "version": "1.0.0", 133 | "depth": 0, 134 | "source": "builtin", 135 | "dependencies": { 136 | "com.unity.modules.imgui": "1.0.0", 137 | "com.unity.modules.jsonserialize": "1.0.0" 138 | } 139 | }, 140 | "com.unity.modules.umbra": { 141 | "version": "1.0.0", 142 | "depth": 0, 143 | "source": "builtin", 144 | "dependencies": {} 145 | }, 146 | "com.unity.modules.unityanalytics": { 147 | "version": "1.0.0", 148 | "depth": 0, 149 | "source": "builtin", 150 | "dependencies": { 151 | "com.unity.modules.unitywebrequest": "1.0.0", 152 | "com.unity.modules.jsonserialize": "1.0.0" 153 | } 154 | }, 155 | "com.unity.modules.unitywebrequest": { 156 | "version": "1.0.0", 157 | "depth": 0, 158 | "source": "builtin", 159 | "dependencies": {} 160 | }, 161 | "com.unity.modules.unitywebrequestassetbundle": { 162 | "version": "1.0.0", 163 | "depth": 0, 164 | "source": "builtin", 165 | "dependencies": { 166 | "com.unity.modules.assetbundle": "1.0.0", 167 | "com.unity.modules.unitywebrequest": "1.0.0" 168 | } 169 | }, 170 | "com.unity.modules.unitywebrequestaudio": { 171 | "version": "1.0.0", 172 | "depth": 0, 173 | "source": "builtin", 174 | "dependencies": { 175 | "com.unity.modules.unitywebrequest": "1.0.0", 176 | "com.unity.modules.audio": "1.0.0" 177 | } 178 | }, 179 | "com.unity.modules.unitywebrequesttexture": { 180 | "version": "1.0.0", 181 | "depth": 0, 182 | "source": "builtin", 183 | "dependencies": { 184 | "com.unity.modules.unitywebrequest": "1.0.0", 185 | "com.unity.modules.imageconversion": "1.0.0" 186 | } 187 | }, 188 | "com.unity.modules.unitywebrequestwww": { 189 | "version": "1.0.0", 190 | "depth": 0, 191 | "source": "builtin", 192 | "dependencies": { 193 | "com.unity.modules.unitywebrequest": "1.0.0", 194 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 195 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 196 | "com.unity.modules.audio": "1.0.0", 197 | "com.unity.modules.assetbundle": "1.0.0", 198 | "com.unity.modules.imageconversion": "1.0.0" 199 | } 200 | }, 201 | "com.unity.modules.vehicles": { 202 | "version": "1.0.0", 203 | "depth": 0, 204 | "source": "builtin", 205 | "dependencies": { 206 | "com.unity.modules.physics": "1.0.0" 207 | } 208 | }, 209 | "com.unity.modules.video": { 210 | "version": "1.0.0", 211 | "depth": 0, 212 | "source": "builtin", 213 | "dependencies": { 214 | "com.unity.modules.audio": "1.0.0", 215 | "com.unity.modules.ui": "1.0.0", 216 | "com.unity.modules.unitywebrequest": "1.0.0" 217 | } 218 | }, 219 | "com.unity.modules.vr": { 220 | "version": "1.0.0", 221 | "depth": 0, 222 | "source": "builtin", 223 | "dependencies": { 224 | "com.unity.modules.jsonserialize": "1.0.0", 225 | "com.unity.modules.physics": "1.0.0", 226 | "com.unity.modules.xr": "1.0.0" 227 | } 228 | }, 229 | "com.unity.modules.wind": { 230 | "version": "1.0.0", 231 | "depth": 0, 232 | "source": "builtin", 233 | "dependencies": {} 234 | }, 235 | "com.unity.modules.xr": { 236 | "version": "1.0.0", 237 | "depth": 0, 238 | "source": "builtin", 239 | "dependencies": { 240 | "com.unity.modules.physics": "1.0.0", 241 | "com.unity.modules.jsonserialize": "1.0.0", 242 | "com.unity.modules.subsystems": "1.0.0" 243 | } 244 | } 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/PresetManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.4.7f1 2 | m_EditorVersionWithRevision: 2019.4.7f1 (e992b1a16e65) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/ProjectSettings/VFXManager.asset -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Please note: This repository is no longer maintained. 2 | 3 | # UnitySkidmarks 4 | 5 | A basic skidmark system intended for vehicles. 6 | Originally written for my game Scraps: Modular Vehicle Combat but intended to be general-purpose. 7 | 8 | UnitySkidmarks is loosely based on a script from an old official Unity car tutorial, but with improved performance and zero garbage generation. 9 | 10 | This repository comes with an example scene built with Unity 5.6, using Unity 5 standard assets for the vehicle and terrain. 11 | 12 | ![Visualisation example.](https://raw.github.com/nition/UnitySkidmarks/master/skid.gif) 13 | 14 | The **UnitySkidmarks** folder is the only content required to make the system work on its own. 15 | 16 | **Skidmarks.cs** is the main controller script, and all skidmark-making objects in the scene should call it. You could turn this into a singleton for easier access. 17 | 18 | **WheelSkid.cs** is an example script for what you might put on a wheel to generate skidmarks. In the example scene, each wheel on the car has a copy of this script. 19 | -------------------------------------------------------------------------------- /skid.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nition/UnitySkidmarks/5b309542854eeea5b7e01a7080a334a4444cce32/skid.gif --------------------------------------------------------------------------------