Compare commits

..
Author SHA1 Message Date
Gregory Campbell 645395a43c Added implementation so that crawling in differentiated from sliding through current player movement 2019-12-06 22:34:57 -05:00
Gregory Campbell ba63ebf72b Added sliding which reverts back to crouching/crawling after 1 second 2019-12-05 23:17:24 -05:00
Gregory Campbell 9c10ca695d Crouching/crawling functionality is working 2019-12-05 22:42:16 -05:00
Gregory CampbellandGitHub c13613ca25 Merge pull request #11 from gjcampbell777/rework_jump_counter
Cleaned up jumping and double jumping implementation
2019-12-05 21:58:53 -05:00
Gregory Campbell 2ade04fcba Cleaned up jumping and double jumping implementation 2019-12-05 21:57:29 -05:00
Gregory Campbell 6c112d7784 Updated Unity version and updated asset packages to avoid deprecation 2019-12-01 16:15:44 -05:00
Gregory CampbellandGitHub b4f80a4cf1 Merge pull request #10 from gjcampbell777/player_capsule_faces_movement_direction
Changed which object rotates when player faces directions and added n…
2019-11-24 17:55:15 -05:00
Gregory Campbell c88ef3ac24 Changed which object rotates when player faces directions and added new texture/material so player front and back are more clear 2019-11-24 17:53:48 -05:00
Gregory Campbell dcdda5d586 Updated Unity version 2019-11-24 17:27:29 -05:00
Gregory Campbell 2d5ce21ea7 Created, Added and Applied a basic texture that helps show which way the player chracter is facing 2019-11-17 20:30:33 -05:00
Gregory CampbellandGitHub a213f1ed56 Merge pull request #9 from gjcampbell777/directional_rotation
Made character direction change more smooth and less binary
2019-11-17 20:18:10 -05:00
Gregory Campbell 4c04f3d802 Made character direction change more smooth and less binary 2019-11-17 20:17:16 -05:00
Gregory CampbellandGitHub 8f6ff0b698 Merge pull request #8 from gjcampbell777/directional_rotation
Directional rotation
2019-11-10 21:07:29 -05:00
Gregory Campbell a0d01964c7 Merge branch 'directional_rotation' of github.com:gjcampbell777/3DSpeedPlatformer into directional_rotation 2019-11-10 21:06:21 -05:00
Gregory Campbell b696d526d5 Player moves based on where the camera is pointing and faces the direction in which it is moving 2019-11-10 21:04:52 -05:00
Gregory Campbell b6ad41aa53 Character faces direction but then input moves character relative to the position character is facing 2019-11-10 20:40:36 -05:00
Gregory CampbellandGitHub d50f3f315e Merge pull request #7 from gjcampbell777/free_rotating_camera
Free rotating camera
2019-11-10 20:39:26 -05:00
Gregory Campbell e99156177b Commented out the reset camera button since that functionality may be useless in the long run 2019-11-10 20:37:51 -05:00
Gregory Campbell 8c48b3bdbb Updated project version and scene 2019-11-10 19:33:17 -05:00
Gregory Campbell 8891b70641 Implemented static y axis rotation when reset button is pressed 2019-10-17 23:40:37 -04:00
Gregory Campbell d8e0b5fa80 Implemented free roam camera. Working on a button which resets camera location. 2019-10-13 14:02:58 -04:00
Gregory Campbell 71667543b7 Character faces direction but then input moves character relative to the position character is facing 2019-10-13 12:56:56 -04:00
Gregory Campbell e104e71bba Updated Unity Version 2019-10-13 12:30:41 -04:00
Gregory Campbell bb50976229 Inital push. Potential start to a camera that can 360 rotate around the player 2019-10-06 20:45:57 -04:00
Gregory CampbellandGitHub a38633b581 Merge pull request #6 from gjcampbell777/player_rotation
Added simple player rotation
2019-10-06 20:32:33 -04:00
25 changed files with 556 additions and 134 deletions
+77
View File
@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Direction Map
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 4e93e73d15a7fa148abf0c451daaa698, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 727f61c75f8320d4ab79aaf01ab76181
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+77
View File
@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Player Face
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 28aab1748f7efc94baac2640b8472174, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 42806559a24f32a43aa4a2670138cf7b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+107 -97
View File
@@ -96,6 +96,7 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
@@ -120,98 +121,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &150911451
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 150911452}
- component: {fileID: 150911455}
- component: {fileID: 150911454}
- component: {fileID: 150911453}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &150911452
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 150911451}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.5, z: 0.5}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children: []
m_Father: {fileID: 741217456}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &150911453
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 150911451}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &150911454
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 150911451}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 2e8066249a525704999c373210d308b9, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &150911455
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 150911451}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &548631447
GameObject:
m_ObjectHideFlags: 0
@@ -244,6 +153,100 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &615882415
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 615882419}
- component: {fileID: 615882418}
- component: {fileID: 615882417}
- component: {fileID: 615882416}
m_Layer: 0
m_Name: Player Object
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!136 &615882416
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 615882415}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &615882417
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 615882415}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 42806559a24f32a43aa4a2670138cf7b, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &615882418
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 615882415}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &615882419
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 615882415}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 741217456}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
@@ -269,8 +272,9 @@ Light:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_Enabled: 1
serializedVersion: 9
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
@@ -395,6 +399,7 @@ MeshRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@@ -469,17 +474,18 @@ MeshRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 741217452}
m_Enabled: 1
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 727f61c75f8320d4ab79aaf01ab76181, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@@ -519,7 +525,7 @@ Transform:
m_LocalPosition: {x: 0, y: 2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 150911452}
- {fileID: 615882419}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -536,8 +542,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
speed: 20
jumpSpeed: 20
jumpHeight: 15
gravity: 5
rotationSpeed: 20
pivot: {fileID: 1402695046}
playerModel: {fileID: 615882415}
--- !u!143 &741217458
CharacterController:
m_ObjectHideFlags: 0
@@ -616,6 +625,7 @@ MeshRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
+18 -9
View File
@@ -19,7 +19,7 @@ public class CameraController : MonoBehaviour
}
pivot.position = player.position;
pivot.parent = player.transform;
pivot.parent = null;
Cursor.visible = !Cursor.visible;
Cursor.lockState = CursorLockMode.Locked;
@@ -27,7 +27,7 @@ public class CameraController : MonoBehaviour
void LateUpdate(){
float camX = Input.GetAxisRaw("Mouse X") * rotateSpeed;
player.Rotate(0, camX, 0);
pivot.Rotate(0, camX, 0);
float camY = Input.GetAxisRaw("Mouse Y") * rotateSpeed;
if (invertY){
@@ -36,6 +36,12 @@ public class CameraController : MonoBehaviour
pivot.Rotate(-camY, 0, 0);
}
if(Input.GetKey(KeyCode.LeftShift))
{
player.Rotate(0, camX, 0);
pivot.Rotate(0, 0, 0);
}
if(pivot.rotation.eulerAngles.x > maxViewAngle && pivot.rotation.eulerAngles.x < 180f)
{
pivot.rotation = Quaternion.Euler(maxViewAngle, 0, 0);
@@ -47,17 +53,20 @@ public class CameraController : MonoBehaviour
}
float camZ = Input.GetAxisRaw("Mouse ScrollWheel");
float angleY = pivot.eulerAngles.y;
float angleX = pivot.eulerAngles.x;
float angleY = player.eulerAngles.y;
float cameraAngle = transform.eulerAngles.y;
//if (Mathf.Abs(cameraAngle - angleY) <= 45){ Potential start for camera following similar to banjo/mario64
/* Code to force the camera behind the player
if(Input.GetKey(KeyCode.LeftShift))
{
angleY = player.eulerAngles.y;
angleX = player.eulerAngles.x;
} */
Quaternion rotation = Quaternion.Euler(angleX, angleY, 0);
transform.position = player.position - (rotation * offset);
float cameraAngle = transform.eulerAngles.y;
//}
Quaternion rotation = Quaternion.Euler(angleX, angleY, 0);
transform.position = player.position - (rotation * offset);
if(transform.position.y < player.position.y){
transform.position = new Vector3(transform.position.x, player.position.y - 0.5f, transform.position.z);
+66 -22
View File
@@ -10,34 +10,44 @@ using System.Collections;
public class PlayerController : MonoBehaviour
{
CharacterController characterController;
CapsuleCollider capsule;
public float speed = 20.0f;
public float jumpSpeed = 15.0f;
public float gravity = 5.0f;
public float rotationSpeed = 150.0f;
public float speed;
public float jumpHeight;
public float gravity;
public float rotationSpeed;
public Transform pivot;
public GameObject playerModel;
private bool extraJump = true;
private int jump = 0;
private float capsuleHeight;
private float controllerHeight;
private float transformHeight;
private Vector3 moveDirection;
float startTime = 0.0f;
float oneSec = 1.0f;
void Start()
{
characterController = GetComponent<CharacterController>();
capsule = GetComponent<CapsuleCollider>();
transformHeight = transform.localScale.y;
controllerHeight = characterController.height;
capsuleHeight = capsule.height;
}
void Update()
{
float yStore = moveDirection.y;
moveDirection = (transform.forward * Input.GetAxisRaw("Vertical")) + (transform.right * Input.GetAxisRaw("Horizontal"));
//Need to switch to 'raw' when using keyboard
moveDirection = (transform.forward * Input.GetAxis("Vertical")) + (transform.right * Input.GetAxis("Horizontal"));
//Player rotation
transform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0);
if (extraJump == true)
if (jump <= 1)
{
moveDirection = moveDirection.normalized * speed; //Remove this line to make running diagonal the fastest standard run
} else
{
} else {
moveDirection = (moveDirection.normalized * speed)/4; //Remove this line to make running diagonal the fastest standard run
}
@@ -45,7 +55,7 @@ public class PlayerController : MonoBehaviour
if (characterController.isGrounded)
{
extraJump = true;
jump = 0;
moveDirection.y = 0.0f;
if(Input.GetKey(KeyCode.LeftShift))
@@ -55,23 +65,57 @@ public class PlayerController : MonoBehaviour
moveDirection = moveDirection.normalized * speed;
}
if (Input.GetButtonDown("Jump"))
if(Input.GetKey(KeyCode.LeftControl))
{
moveDirection.y = jumpSpeed;
}
} else {
if (Input.GetButtonDown("Jump") && extraJump == true)
{
moveDirection.y = jumpSpeed;
extraJump = false;
characterController.height /= 2;
capsule.height /= 2;
transform.localScale = new Vector3(transform.localScale.x, transformHeight/2, transform.localScale.z);
if(Input.GetKeyDown(KeyCode.LeftControl))
{
startTime = Time.time;
}
if(characterController.velocity != new Vector3(0, 0, 0) && startTime + oneSec >= Time.time)
{
moveDirection = (moveDirection.normalized * speed * 2);
} else {
moveDirection = (moveDirection.normalized * speed/4);
}
} else {
moveDirection = moveDirection.normalized * speed;
characterController.height = controllerHeight;
capsule.height = capsuleHeight;
transform.localScale = new Vector3(transform.localScale.x, transformHeight, transform.localScale.z);
}
}
moveDirection.y = moveDirection.y + (Physics.gravity.y * gravity * Time.deltaTime);
if (Input.GetButtonDown("Jump") && jump <= 1)
{
moveDirection.y = jumpHeight;
jump++;
}
moveDirection.y += Physics.gravity.y * gravity * Time.deltaTime;
// Move the controller
characterController.Move(moveDirection * Time.deltaTime);
//Move the player in different directions based on camera look direction
//Need to switch to 'raw' when using keyboard
if(Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0)
{
transform.rotation = Quaternion.Euler(0f, pivot.rotation.eulerAngles.y, 0f);
Quaternion newRotation = Quaternion.LookRotation(new Vector3(moveDirection.x, 0f, moveDirection.z));
playerModel.transform.rotation = Quaternion.Slerp(playerModel.transform.rotation, newRotation, rotationSpeed * Time.deltaTime);
}
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 184ab3d096bbce9488707cce0f00b516
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: 4e93e73d15a7fa148abf0c451daaa698
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: 28aab1748f7efc94baac2640b8472174
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
+3 -4
View File
@@ -3,11 +3,10 @@
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.1.0",
"com.unity.ide.vscode": "1.1.2",
"com.unity.package-manager-ui": "2.2.0",
"com.unity.test-framework": "1.0.13",
"com.unity.ide.vscode": "1.1.3",
"com.unity.test-framework": "1.1.3",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.1.0",
"com.unity.timeline": "1.2.6",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,2 +1,2 @@
m_EditorVersion: 2019.2.8f1
m_EditorVersionWithRevision: 2019.2.8f1 (ff5b465c8d13)
m_EditorVersion: 2019.3.0f1
m_EditorVersionWithRevision: 2019.3.0f1 (ffacea4b84e7)
Binary file not shown.
Binary file not shown.
Binary file not shown.