20231229H修改动画

This commit is contained in:
hongyan 2023-12-29 13:52:37 +08:00
parent b68507984f
commit f644b2ef9a
41 changed files with 8263 additions and 7914 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1bceb84a4caa12747ba3e677114d677b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -83,7 +83,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pagao2
m_Name: Animation1
m_Speed: 1.5
m_CycleOffset: 0
m_Transitions:

View File

@ -26,239 +26,12 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -75.16148, y: 0.50000024, z: 19.052464}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5238995341324400300}
- {fileID: 7131429485507705391}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4153266177252591619
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5238995341324400300}
m_Layer: 0
m_Name: Bip001 Footsteps
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5238995341324400300
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4153266177252591619}
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 74.42314, y: 0.03152007, z: -18.577421}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 843131925845433972}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &843131925371273563
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 843131925845433972}
m_Modifications:
- target: {fileID: 7585334257869208435, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_Name
value: man2
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208440, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 1f3b559df7f225e49b1eab7ec3528302, type: 2}
- target: {fileID: 7585334257869208440, guid: 961186233485c58498e53394efd7cbd8, type: 3}
propertyPath: m_ApplyRootMotion
value: 1
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 7585334259180864466, guid: 961186233485c58498e53394efd7cbd8, type: 3}
- {fileID: 7585334257869208438, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 961186233485c58498e53394efd7cbd8, type: 3}
--- !u!1 &7131429484647437351 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7585334258754098556, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!65 &843131924938664440
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7131429484647437351}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.101344444, y: 0.0746765, z: 0.1278126}
m_Center: {x: 0.06291358, y: 0.0019303941, z: 0.047503885}
--- !u!1 &7131429485507705384 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7585334257869208435, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!114 &843131924239483818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7131429485507705384}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1021e3bd779a7c40ba8fa9878d94352, type: 3}
m_Name:
m_EditorClassIdentifier:
childObjects:
- {fileID: 2045639492677258551}
delayInSeconds: 1
--- !u!4 &7131429485507705391 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7131429485806283834 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7585334257563807073, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7131429485806283835 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7585334257563807072, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!65 &843131924372094276
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7131429485806283835}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.09636379, y: 0.08358461, z: 0.1278126}
m_Center: {x: -0.055676635, y: 0.0063843546, z: 0.047503736}
--- !u!1001 &843131925886114701
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7131429485806283834}
m_Modifications:
- target: {fileID: 1716146624749786810, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_Name
value: xiangzi2
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalPosition.x
value: 0.006
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalPosition.y
value: -0.057
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalPosition.z
value: 0.051
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalRotation.w
value: -0.1475794
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalRotation.x
value: -0.15239999
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalRotation.y
value: 0.4915303
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalRotation.z
value: -0.8446257
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 61.081
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 373.436
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 168.129
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b7165b8870e7eac47931694209670168, type: 3}
--- !u!1 &2045639492677258551 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1716146624749786810, guid: b7165b8870e7eac47931694209670168, type: 3}
m_PrefabInstance: {fileID: 843131925886114701}
m_PrefabAsset: {fileID: 0}
--- !u!54 &843131924526512263
Rigidbody:
m_ObjectHideFlags: 0
@ -288,3 +61,260 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 0.36550626, y: 0.30000025, z: 0.30000016}
m_Center: {x: -0.0000004969537, y: 0.000000035762785, z: 0.14999624}
--- !u!1 &4153266177252591619
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5238995341324400300}
m_Layer: 0
m_Name: Bip001 Footsteps
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5238995341324400300
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4153266177252591619}
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 74.42314, y: 0.03152007, z: -18.577421}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 843131925845433972}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &843131924938664440
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7131429484647437351}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.101344444, y: 0.0746765, z: 0.1278126}
m_Center: {x: 0.06291358, y: 0.0019303941, z: 0.047503885}
--- !u!114 &843131924239483818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7131429485507705384}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1021e3bd779a7c40ba8fa9878d94352, type: 3}
m_Name:
m_EditorClassIdentifier:
childObjects:
- {fileID: 2045639492677258551}
delayInSeconds: 1
--- !u!65 &843131924372094276
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7131429485806283835}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.09636379, y: 0.08358461, z: 0.1278126}
m_Center: {x: -0.055676635, y: 0.0063843546, z: 0.047503736}
--- !u!1001 &843131925371273563
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 843131925845433972}
m_Modifications:
- target: {fileID: 7585334257869208435, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_Name
value: man2
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7585334257869208440, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 1f3b559df7f225e49b1eab7ec3528302, type: 2}
- target: {fileID: 7585334257869208440, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
propertyPath: m_ApplyRootMotion
value: 1
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 7585334259180864466, guid: 961186233485c58498e53394efd7cbd8, type: 3}
- {fileID: 7585334257869208438, guid: 961186233485c58498e53394efd7cbd8, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 961186233485c58498e53394efd7cbd8, type: 3}
--- !u!1 &7131429485507705384 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7585334257869208435, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7131429485507705391 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7585334257869208436, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7131429485806283835 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7585334257563807072, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7131429485806283834 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7585334257563807073, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7131429484647437351 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7585334258754098556, guid: 961186233485c58498e53394efd7cbd8,
type: 3}
m_PrefabInstance: {fileID: 843131925371273563}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &843131925886114701
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7131429485806283834}
m_Modifications:
- target: {fileID: 1716146624749786810, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_Name
value: xiangzi2
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.006
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.057
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.051
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.4550814
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.5123364
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.46108207
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalRotation.z
value: -0.5637515
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 61.081
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 373.436
objectReference: {fileID: 0}
- target: {fileID: 2061288463189281792, guid: b7165b8870e7eac47931694209670168,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 168.129
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b7165b8870e7eac47931694209670168, type: 3}
--- !u!1 &2045639492677258551 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1716146624749786810, guid: b7165b8870e7eac47931694209670168,
type: 3}
m_PrefabInstance: {fileID: 843131925886114701}
m_PrefabAsset: {fileID: 0}

View File

@ -3,48 +3,79 @@ using System.Collections;
public class SetParentScript : MonoBehaviour
{
// Assign these in the Inspector
public GameObject objectA; // The object you want to become a child and to lock/unlock
public GameObject objectB; // The object to become the parent
public GameObject objectA; // 想要成为子对象并且锁定/解锁的对象
public GameObject objectB; // 想要成为父对象的对象
private Rigidbody rbA; // Rigidbody of objectA
// Adjustable positions and rotations
public Vector3 positionOffset; // 调整的位置偏移量
public Vector3 rotationOffset; // 调整的旋转偏移量
private Rigidbody rbA; // objectA的Rigidbody组件
private Transform originalParent; // objectA的原始父对象
private RigidbodyConstraints originalConstraints; // objectA原始的Rigidbody约束
private Vector3 originalPosition; // objectA的原始位置
private Quaternion originalRotation; // objectA的原始旋转
// Start is called before the first frame update
void Start()
{
// Check if objectA has a Rigidbody component
// 获取objectA的Rigidbody组件
rbA = objectA.GetComponent<Rigidbody>();
if (rbA == null)
{
// Log an error if no Rigidbody is found
Debug.LogError("No Rigidbody found on objectA");
// 如果没有找到Rigidbody组件则记录错误
Debug.LogError("没有在objectA上找到Rigidbody组件");
return;
}
// Lock the Rigidbody by setting constraints
LockMotionAndRotation();
// 保存objectA的原始父对象、位置、旋转和Rigidbody约束
originalParent = objectA.transform.parent;
originalPosition = objectA.transform.position;
originalRotation = objectA.transform.rotation;
originalConstraints = rbA.constraints;
// Call the methods after 3 seconds
Invoke("SetParent", 3f);
Invoke("UnlockMotionAndRotation", 3f);
// 锁定Rigidbody并在3秒后改变父对象和解锁
LockMotionAndRotation();
Invoke("ChangeParentAndUnlock", 3f);
}
void ChangeParentAndUnlock()
{
// 改变objectA的父对象并解锁Rigidbody
SetParent();
UnlockMotionAndRotation();
}
// Method to set the new parent of the object
void SetParent()
{
// Setting objectA as a child of objectB
// 设置objectA为objectB的子对象
objectA.transform.SetParent(objectB.transform);
}
void LockMotionAndRotation()
{
// Lock position and rotation by setting constraints
// 锁定位置和旋转通过设置Rigidbody的约束
rbA.constraints = RigidbodyConstraints.FreezePosition | RigidbodyConstraints.FreezeRotation;
}
void UnlockMotionAndRotation()
{
// Unlock all constraints to allow movement and rotation again
// 解锁所有Rigidbody约束以允许再次移动和旋转
rbA.constraints = RigidbodyConstraints.None;
}
public void ResetToInitialState()
{
// 将objectA的父对象重置为其原始父对象
objectA.transform.SetParent(originalParent);
// 将objectA的位置重置为其原始位置并应用偏移量
objectA.transform.position = originalPosition + positionOffset;
// 将objectA的旋转重置为其原始旋转并应用偏移量
objectA.transform.rotation = originalRotation * Quaternion.Euler(rotationOffset);
// 将objectA的Rigidbody约束重置为最初的约束
rbA.constraints = originalConstraints;
// 可选重新锁定并准备在3秒后改变父对象和解锁
LockMotionAndRotation();
Invoke("ChangeParentAndUnlock", 3f);
}
}

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.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
{
"process_id" : 5124,
"version" : "2019.4.9f1",
"app_path" : "D:/Unity/2019.4.9f1/Editor/Unity.exe",
"app_contents_path" : "D:/Unity/2019.4.9f1/Editor/Data"
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[-617052,-485238,-55030,-48636,-48624,-48616,-36344,-36324,-36078,-33370,-22538,-22528,-15810,-14838,-14826,-14800,-14770,-14742,-14738,-14458,-14442,-14362,-12356,-12310,-12152,-12102,-12090,-11228,-11214,-11186,-11174,-11164,-11026,-10868,-10860,-10840,-4364,-1184,18736,24988,25064,25614,25658,29190,30052,30948,33522,36084,36192,36770,36816,39684,40180,40264],"m_ScrollY":2791.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":33342}
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[],"m_ScrollY":0.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":0}

View File

@ -1 +1 @@
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[-24304,-1184],"m_ScrollY":0.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":0}
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[],"m_ScrollY":0.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":0}

View File

@ -1 +1 @@
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":false,"pivot":{"x":-0.11478721350431442,"y":-0.0320139080286026,"z":-35.37715148925781},"rotation":{"x":-0.1563953310251236,"y":-0.7768510580062866,"z":0.21249434351921082,"w":-0.5717731714248657},"size":3.0982770919799806,"orthographic":false}
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":false,"pivot":{"x":-94.65216064453125,"y":-95.95146942138672,"z":-25.940929412841798},"rotation":{"x":0.3323466181755066,"y":-0.4839622676372528,"z":0.2053948938846588,"w":0.7830454707145691},"size":70.7106704711914,"orthographic":false}

Binary file not shown.

View File

@ -60,3 +60,5 @@ Cmd: compileSnippet
api=4 type=0 insize=5528 outsize=1294 kw=UNITY_PASS_FORWARDADD DIRECTIONAL FOG_LINEAR pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING ok=1
Cmd: compileSnippet
api=4 type=1 insize=5528 outsize=978 kw=UNITY_PASS_FORWARDADD DIRECTIONAL FOG_LINEAR pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING ok=1
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process

View File

@ -1,2 +1,4 @@
Base path: 'D:/Unity/2019.4.9f1/Editor/Data', plugins path 'D:/Unity/2019.4.9f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Quitting shader compiler process