wire player control setup and tune the third-person controller
Editor/PlayerControlSetup.cs is the one-shot menu that assembles the playable player: the armature, the Cinemachine rig, the NavMesh agent, and the pointer input wiring, so a scene can be brought up to a controllable state repeatably rather than by hand. StarterAssets input actions gain the pointer and interaction bindings the new locomotion and interaction layers read, and PlayerArmature is updated to match. ThirdPersonController blends the animator toward target speed scaled by input magnitude. Previously a partial stick deflection or a click-to-move arrival played a slowed run clip via MotionSpeed alone; scaling the blend makes those use the walk cycle instead. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -36,6 +36,46 @@
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "Menu",
|
||||
"type": "Button",
|
||||
"id": "e81d9782-4d9d-4a8b-b5a3-bc2f31e1cdcc",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "Point",
|
||||
"type": "PassThrough",
|
||||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "Click",
|
||||
"type": "Button",
|
||||
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "CameraPan",
|
||||
"type": "Button",
|
||||
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "PointerDelta",
|
||||
"type": "PassThrough",
|
||||
"id": "d4e5f6a7-b8c9-0123-def0-234567890123",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
@@ -214,6 +254,83 @@
|
||||
"action": "Sprint",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "0f5e00e8-de3a-454f-8338-4348e69ac91a",
|
||||
"path": "<Keyboard>/tab",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
"action": "Menu",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "8533b9e3-7efc-442a-9d07-8fe1b29a3bf0",
|
||||
"path": "<Gamepad>/start",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Menu",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "e5f6a7b8-c9d0-1234-ef01-345678901234",
|
||||
"path": "<Mouse>/position",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
"action": "Point",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "f6a7b8c9-d0e1-2345-f012-456789012345",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
"action": "Click",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "a7b8c9d0-e1f2-3456-0123-567890123456",
|
||||
"path": "<Mouse>/middleButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
"action": "CameraPan",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "b8c9d0e1-f2a3-4567-1234-678901234567",
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
"action": "CameraPan",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "c9d0e1f2-a3b4-5678-2345-789012345678",
|
||||
"path": "<Mouse>/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "KeyboardMouse",
|
||||
"action": "PointerDelta",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+89
-3
@@ -1037,6 +1037,11 @@ GameObject:
|
||||
- component: {fileID: 5885216827943657505}
|
||||
- component: {fileID: 135756642000475821}
|
||||
- component: {fileID: 4416926081852918493}
|
||||
- component: {fileID: 4411642300945204457}
|
||||
- component: {fileID: 2899400238410355188}
|
||||
- component: {fileID: 5730189035290769348}
|
||||
- component: {fileID: 1531343089306214720}
|
||||
- component: {fileID: 4718598727395454326}
|
||||
m_Layer: 8
|
||||
m_Name: PlayerArmature
|
||||
m_TagString: Player
|
||||
@@ -1155,7 +1160,7 @@ MonoBehaviour:
|
||||
TopClamp: 70
|
||||
BottomClamp: -30
|
||||
CameraAngleOverride: 0
|
||||
LockCameraPosition: 0
|
||||
LockCameraPosition: 1
|
||||
--- !u!114 &5885216827943657505
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1189,8 +1194,8 @@ MonoBehaviour:
|
||||
look: {x: 0, y: 0}
|
||||
jump: 0
|
||||
sprint: 0
|
||||
analogMovement: 0
|
||||
cursorLocked: 1
|
||||
analogMovement: 1
|
||||
cursorLocked: 0
|
||||
cursorInputForLook: 1
|
||||
--- !u!114 &4416926081852918493
|
||||
MonoBehaviour:
|
||||
@@ -1290,6 +1295,87 @@ MonoBehaviour:
|
||||
m_DefaultActionMap: Player
|
||||
m_SplitScreenIndex: -1
|
||||
m_Camera: {fileID: 0}
|
||||
--- !u!114 &4411642300945204457
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4416926081852918481}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ff77faf7e79154095ad57ad50df8c605, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.Player.PlayerPointerInput
|
||||
--- !u!114 &2899400238410355188
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4416926081852918481}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 91bf24256c6694185b4247a736593727, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.Player.PlayerMotionArbiter
|
||||
directInputCancelThreshold: 0.15
|
||||
runDistanceThreshold: 6
|
||||
--- !u!195 &5730189035290769348
|
||||
NavMeshAgent:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4416926081852918481}
|
||||
m_Enabled: 1
|
||||
m_AgentTypeID: 0
|
||||
m_Radius: 0.5
|
||||
m_Speed: 3.5
|
||||
m_Acceleration: 8
|
||||
avoidancePriority: 50
|
||||
m_AngularSpeed: 120
|
||||
m_StoppingDistance: 0
|
||||
m_AutoTraverseOffMeshLink: 1
|
||||
m_AutoBraking: 1
|
||||
m_AutoRepath: 1
|
||||
m_Height: 2
|
||||
m_BaseOffset: 0
|
||||
m_WalkableMask: 4294967295
|
||||
m_ObstacleAvoidanceType: 4
|
||||
--- !u!114 &1531343089306214720
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4416926081852918481}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c2762b30721644611b9672bd4781cf15, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.Player.ClickToMoveController
|
||||
brainCamera: {fileID: 0}
|
||||
runDistanceThreshold: 6
|
||||
--- !u!114 &4718598727395454326
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4416926081852918481}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f62460e35fda4829bd6ffeffe633a7e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::NightclubArcadia.Player.PointerNavigationInput
|
||||
brainCamera: {fileID: 0}
|
||||
clickMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
pointerInput: {fileID: 4411642300945204457}
|
||||
clickToMove: {fileID: 1531343089306214720}
|
||||
motionArbiter: {fileID: 2899400238410355188}
|
||||
--- !u!1 &4523139366846529165
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
+5
-1
@@ -248,7 +248,11 @@ namespace StarterAssets
|
||||
_speed = targetSpeed;
|
||||
}
|
||||
|
||||
_animationBlend = Mathf.Lerp(_animationBlend, targetSpeed, Time.deltaTime * SpeedChangeRate);
|
||||
// NightclubArcadia: blend toward speed scaled by input magnitude so
|
||||
// partial stick / click-to-move arrival uses walk cycles, not a
|
||||
// slowed run clip via MotionSpeed alone.
|
||||
_animationBlend = Mathf.Lerp(_animationBlend, targetSpeed * inputMagnitude,
|
||||
Time.deltaTime * SpeedChangeRate);
|
||||
if (_animationBlend < 0.01f) _animationBlend = 0f;
|
||||
|
||||
// normalise input direction
|
||||
|
||||
Reference in New Issue
Block a user