浏览代码

fix rotation bug

/hh-develop-water-balloon-fight
HH 4 年前
当前提交
6fdd207a
共有 5 个文件被更改,包括 143 次插入142 次删除
  1. 8
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/AgentCubeMovement.cs
  2. 3
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/MouseLook.cs
  3. 2
      Project/Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.cs
  4. 272
      Project/Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.inputactions

8
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/AgentCubeMovement.cs


public void Look(float xRot = 0, float yRot = 0)
{
// Read the mouse input axis
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX += xRot * sensitivityX;
rotationY += yRot * sensitivityY;
// rotationX += xRot * sensitivityX * Time.deltaTime;
// rotationY += yRot * sensitivityY * Time.deltaTime;
// rotationX += Input.GetAxis("Mouse X") * sensitivityX;
// rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX = ClampAngle(rotationX, minimumX, maximumX);
rotationY = ClampAngle(rotationY, minimumY, maximumY);

3
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/MouseLook.cs


void Start()
{
// Make the rigid body not change rotation
// if (rigidbody)
// rigidbody.freezeRotation = true;
originalRotation = transform.localRotation;
}

2
Project/Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.cs


""id"": ""578caa03-6827-4797-adfc-a59770c437fe"",
""path"": ""<Pointer>/delta"",
""interactions"": """",
""processors"": ""ScaleVector2(x=2,y=2)"",
""processors"": """",
""groups"": """",
""action"": ""look"",
""isComposite"": false,

272
Project/Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.inputactions


{
"name": "SimpleControls",
"maps": [
{
"name": "gameplay",
"id": "265c38f5-dd18-4d34-b198-aec58e1627ff",
"actions": [
{
"name": "fire",
"type": "Button",
"id": "1077f913-a9f9-41b1-acb3-b9ee0adbc744",
"expectedControlType": "Button",
"processors": "",
"interactions": "Tap,SlowTap"
},
{
"name": "move",
"type": "Value",
"id": "50fd2809-3aa3-4a90-988e-1facf6773553",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "look",
"type": "Value",
"id": "c60e0974-d140-4597-a40e-9862193067e9",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "",
"id": "abb776f3-f329-4f7b-bbf8-b577d13be018",
"path": "*/{PrimaryAction}",
"interactions": "",
"processors": "",
"groups": "",
"action": "fire",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "e1b8c4dd-7b3a-4db6-a93a-0889b59b1afc",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "Dpad",
"id": "cefc16fc-557a-44b0-939f-2ad792876b07",
"path": "Dpad",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "07244659-79df-461d-b329-defbe2fbc5f6",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "f0ec75cb-f02c-40d2-a33f-1fd6eab2ae0b",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "21fe6bfe-4721-4483-9f4a-a0031ade105c",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "2dd39746-c75c-4a11-838a-e59eacaf4e0b",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "c106d6e6-2780-47ff-b318-396171bd54cc",
"path": "<Gamepad>/rightStick",
"interactions": "",
"processors": "",
"groups": "",
"action": "look",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "578caa03-6827-4797-adfc-a59770c437fe",
"path": "<Pointer>/delta",
"interactions": "",
"processors": "ScaleVector2(x=2,y=2)",
"groups": "",
"action": "look",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
{
"name": "SimpleControls",
"maps": [
{
"name": "gameplay",
"id": "265c38f5-dd18-4d34-b198-aec58e1627ff",
"actions": [
{
"name": "fire",
"type": "Button",
"id": "1077f913-a9f9-41b1-acb3-b9ee0adbc744",
"expectedControlType": "Button",
"processors": "",
"interactions": "Tap,SlowTap"
},
{
"name": "move",
"type": "Value",
"id": "50fd2809-3aa3-4a90-988e-1facf6773553",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "look",
"type": "Value",
"id": "c60e0974-d140-4597-a40e-9862193067e9",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "",
"id": "abb776f3-f329-4f7b-bbf8-b577d13be018",
"path": "*/{PrimaryAction}",
"interactions": "",
"processors": "",
"groups": "",
"action": "fire",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "e1b8c4dd-7b3a-4db6-a93a-0889b59b1afc",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "Dpad",
"id": "cefc16fc-557a-44b0-939f-2ad792876b07",
"path": "Dpad",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "07244659-79df-461d-b329-defbe2fbc5f6",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "f0ec75cb-f02c-40d2-a33f-1fd6eab2ae0b",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "21fe6bfe-4721-4483-9f4a-a0031ade105c",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "2dd39746-c75c-4a11-838a-e59eacaf4e0b",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "c106d6e6-2780-47ff-b318-396171bd54cc",
"path": "<Gamepad>/rightStick",
"interactions": "",
"processors": "",
"groups": "",
"action": "look",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "578caa03-6827-4797-adfc-a59770c437fe",
"path": "<Pointer>/delta",
"interactions": "",
"processors": "",
"groups": "",
"action": "look",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
}

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存