Everything final

dev-hazim
Hazim 1 month ago
parent 9570aa23d3
commit cc4f3643f5

@ -812,15 +812,17 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
baseSpeed: 1
maxSpeed: 10
acceleration: 5
constantSpeed: 5
maxSpeed: 1
acceleration: 1
constantSpeed: 1
useTapToMove: 1
tapWindowSeconds: 0.5
jumpPower: 2
jumpDuration: 0.5
jumpDistance: 3
pathSource: {fileID: 1656857050}
faceMovementDirection: 1
rotationSpeed: 10
hurdles: []
--- !u!136 &460914824
CapsuleCollider:
@ -852,7 +854,7 @@ MeshRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 460914822}
m_Enabled: 1
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
@ -907,7 +909,8 @@ Transform:
m_LocalPosition: {x: -53.17, y: 11.31, z: 83.89}
m_LocalScale: {x: 1.2563, y: 1.2563, z: 1.2563}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 1047584476}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &497635347
@ -1249,6 +1252,11 @@ Transform:
- {fileID: 554228239}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!4 &1047584476 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
m_PrefabInstance: {fileID: 1990116857}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1336577929
GameObject:
m_ObjectHideFlags: 0
@ -2768,6 +2776,331 @@ CanvasGroup:
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1001 &1990116857
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 460914827}
m_Modifications:
- target: {fileID: -9070493210130169274, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalScale.x
value: 1.392661
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalScale.y
value: 1.392661
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalScale.z
value: 1.392661
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalPosition.y
value: -0.8437479
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8183481454299698827, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -8006009767450596044, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -7657966619581158213, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -7360747449169001873, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -6621945745981909287, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -6615165312655902727, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -6370085079684087283, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -6234591296559379751, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -6170625038081293824, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -6056541330796499132, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -5857696854640597626, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -5561550452697079657, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -5195048882033904264, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -4999088201633142198, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -4728426434207774260, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -4501530691011011137, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -4332706925441422008, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -4278032810995721380, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -3799395697873186154, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -3542885339558904099, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -3478013746326755454, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -3086436065929644917, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -2084811680363313996, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -1781356600409242780, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -1703473491307067327, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -1425791611860619382, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -1200856079203341021, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -751476226918971245, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -552831747908440785, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -290750445479886849, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -203856693384778745, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: -76546954072915012, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 9171100556185337, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Name
value: Ch14_nonPBR
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_TagString
value: Player
objectReference: {fileID: 0}
- target: {fileID: 1082271958561512970, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 1339101018200438765, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 1711505207429034123, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2158975759703390516, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2586065998465600510, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2715566404302941441, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2898355158428612036, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3047284246813455858, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3135921509060577837, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3614653200513675785, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3882815353823017779, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3948933247560734027, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3974016661214395164, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4114030615378554161, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4237274458221626025, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4441848305933595309, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4549111882529890269, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5120724536234783804, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5866666021909216657, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 41d97b0019dec9a49aad53fbdea1e16c, type: 2}
- target: {fileID: 5866666021909216657, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7363479242261063072, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 7732535366517880319, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 7776229726456038893, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8817898888258712963, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8953972740105248388, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
- target: {fileID: 9037727976738196030, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_Layer
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
--- !u!1 &2068627304
GameObject:
m_ObjectHideFlags: 0

@ -273,7 +273,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!81 &114409650
AudioListener:
m_ObjectHideFlags: 0
@ -341,8 +341,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 114409649}
serializedVersion: 2
m_LocalRotation: {x: -0.0000000043716724, y: 0.98473316, z: -0.17407075, w: -0.000000024730925}
m_LocalPosition: {x: -53.17, y: 17.66, z: 101.29}
m_LocalRotation: {x: 5.187698e-10, y: 0.9945558, z: -0.104205824, w: 0.0000000049512154}
m_LocalPosition: {x: -53.17, y: 17.66, z: 113.86}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -1010,6 +1010,8 @@ MonoBehaviour:
jumpDuration: 0.7
jumpDistance: 7
pathSource: {fileID: 1656857050}
faceMovementDirection: 1
rotationSpeed: 10
hurdles: []
--- !u!136 &460914824
CapsuleCollider:
@ -1761,7 +1763,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1166905330
Transform:
m_ObjectHideFlags: 0
@ -2283,7 +2285,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 6.35, z: 17.4}
m_FollowOffset: {x: 0, y: 6.35, z: 29.97}
m_XDamping: 0
m_YDamping: 0
m_ZDamping: 0
@ -2369,19 +2371,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.y
value: 0.7071068
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -2389,7 +2391,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 90
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6efbd578906c37c4a9e8fd4a6cc0b5a8, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
@ -2874,7 +2876,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1646085380
MonoBehaviour:
m_ObjectHideFlags: 0
@ -2893,7 +2895,7 @@ MonoBehaviour:
m_StreamingVersion: 20170927
m_Priority: 10
m_StandbyUpdate: 2
m_LookAt: {fileID: 0}
m_LookAt: {fileID: 460914827}
m_Follow: {fileID: 460914827}
m_Lens:
FieldOfView: 60.000004
@ -2922,8 +2924,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1646085379}
serializedVersion: 2
m_LocalRotation: {x: -0.0000000043716724, y: 0.98473316, z: -0.17407075, w: -0.000000024730925}
m_LocalPosition: {x: -53.17, y: 17.66, z: 101.29}
m_LocalRotation: {x: 5.1876986e-10, y: 0.9945558, z: -0.104205824, w: 0.000000004951216}
m_LocalPosition: {x: -53.17, y: 17.66, z: 113.86}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:

@ -24,6 +24,8 @@ public class PlayerPathRunner : MonoBehaviour
[Header("Path Setup")]
public DOTweenPath pathSource;
public bool faceMovementDirection = true;
public float rotationSpeed = 10f;
[Header("Hurdle Setup")]
public List<Transform> hurdles; // Assign all hurdles here
@ -127,6 +129,19 @@ public class PlayerPathRunner : MonoBehaviour
Vector3 pos = Vector3.Lerp(drawPoints[iA], drawPoints[iB], t);
transform.position = pos;
// Handle rotation to face movement direction
if (faceMovementDirection && iB < drawPoints.Length)
{
Vector3 direction = drawPoints[iB] - drawPoints[iA];
direction.y = 0; // Keep rotation only on Y axis (no tilting)
if (direction != Vector3.zero)
{
Quaternion targetRotation = Quaternion.LookRotation(direction);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
}
}
}
public void TriggerJump(System.Action onComplete = null)
@ -152,6 +167,18 @@ public class PlayerPathRunner : MonoBehaviour
// Do the jump
transform.DOJump(endPos, jumpPower, 1, jumpDuration)
.SetEase(Ease.OutQuad)
.OnUpdate(() => {
// Update rotation during jump to face the landing direction
if (faceMovementDirection)
{
Vector3 jumpDirection = GetDirectionAtPathPosition(targetPathPosition);
if (jumpDirection != Vector3.zero)
{
Quaternion targetRot = Quaternion.LookRotation(jumpDirection);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRot, rotationSpeed * Time.deltaTime);
}
}
})
.OnComplete(() => {
// Update our path position to match where we jumped to
pathPosition = targetPathPosition;
@ -183,6 +210,17 @@ public class PlayerPathRunner : MonoBehaviour
return Vector3.Lerp(drawPoints[iA], drawPoints[iB], t);
}
Vector3 GetDirectionAtPathPosition(float normalizedPos)
{
float floatIndex = normalizedPos * (drawPoints.Length - 1);
int iA = Mathf.FloorToInt(floatIndex);
int iB = Mathf.Min(iA + 1, drawPoints.Length - 1);
Vector3 direction = drawPoints[iB] - drawPoints[iA];
direction.y = 0; // Keep only horizontal direction
return direction.normalized;
}
public float GetCurrentSpeed()
{
return currentSpeed;

@ -5,6 +5,9 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Scenes/Menu.unity
guid: 2ba398b23b51a3c489a7481998a5a1bb
- enabled: 1
path: Assets/Scenes/Env 1.unity
guid: 0784de0b299ed4b41b845ca3d37a7a9d

@ -12,7 +12,7 @@ PlayerSettings:
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
companyName: Rizze
productName: ReactRaceTrack
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}

Loading…
Cancel
Save