新增旋转功能

HDRP
Yogi 2025-01-09 21:04:52 +08:00
parent 317553699e
commit be53fd73d5
3 changed files with 154 additions and 9 deletions

View File

@ -245,6 +245,31 @@ Transform:
m_Children: []
m_Father: {fileID: 604712594}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &223334191 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5218155922998809704, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
m_PrefabInstance: {fileID: 6664335491598370550}
m_PrefabAsset: {fileID: 0}
--- !u!4 &223334192 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
m_PrefabInstance: {fileID: 6664335491598370550}
m_PrefabAsset: {fileID: 0}
--- !u!114 &223334193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 223334191}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2456e189d175ec14f981ec5dc8f21b33, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 223334192}
rotateSpeed: -30
FreeTime: 30
--- !u!1 &251978103
GameObject:
m_ObjectHideFlags: 0
@ -1351,6 +1376,53 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 5506468342675174862, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
m_PrefabInstance: {fileID: 6664335491598370550}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1241170118
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1241170119}
- component: {fileID: 1241170120}
m_Layer: 0
m_Name: RotateCameraCenter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1241170119
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241170118}
serializedVersion: 2
m_LocalRotation: {x: 0.14195606, y: 0.14415787, z: -0.020900985, w: 0.9790966}
m_LocalPosition: {x: -2.7635517, y: 2.840037, z: -9.181348}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1241170120
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241170118}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2456e189d175ec14f981ec5dc8f21b33, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 668196392}
rotateSpeed: 0.1
FreeTime: 1
--- !u!1 &1288110412 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2881457540606939832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
@ -1792,27 +1864,27 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalPosition.x
value: -0.03
value: 0
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalPosition.y
value: -0.6
value: 0
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalPosition.z
value: -1.08
value: 0
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.w
value: -0.05573427
value: 1
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.y
value: -0.99844563
value: 0
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.z
@ -1824,25 +1896,65 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -186.39
value: 0
objectReference: {fileID: 0}
- target: {fileID: 251226097386157602, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalPosition.x
value: -0.03
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalPosition.y
value: -0.6
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalPosition.z
value: -1.08
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.w
value: -0.05573427
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.y
value: -0.99844563
objectReference: {fileID: 0}
- target: {fileID: 4332512220139617832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4830004066221561861, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5218155922998809704, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_Name
value: "\u6839\u8282\u70B9(\u63A7\u5236\u5168\u8F66\u65CB\u8F6C)"
value: "\u6839\u8282\u70B9(\u4E0D\u8981\u4FEE\u6539\u4F4D\u7F6E)"
objectReference: {fileID: 0}
- target: {fileID: 7574252367231446458, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
propertyPath: m_Name
value: "\u8F66\u8F86Body(\u53EF\u4EE5\u4FEE\u6539\u5750\u6807\u4E0E\u65CB\u8F6C)"
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 5218155922998809704, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
insertIndex: -1
addedObject: {fileID: 223334193}
m_SourcePrefab: {fileID: 100100000, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1241170119}
- {fileID: 961739753}
- {fileID: 668196392}
- {fileID: 1160234427}

View File

@ -0,0 +1,31 @@
using System;
using UnityEngine;
public class RotateAroundTargetAnim : MonoBehaviour
{
public Transform target;
public float rotateSpeed = .1f;
private float triggerTimer;
public float FreeTime = 1;
private void FixedUpdate()
{
if (triggerTimer >= FreeTime)
{
this.transform.RotateAround(target.position, target.up, Time.fixedDeltaTime * rotateSpeed);
}
}
private void Update()
{
if (Input.anyKey)
{
triggerTimer = 0;
}
else
{
triggerTimer += Time.deltaTime;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2456e189d175ec14f981ec5dc8f21b33