rope处理
This commit is contained in:
@@ -18628,411 +18628,6 @@ MonoBehaviour:
|
|||||||
- {fileID: 102900000, guid: 60ac19fbbe20cec48add96b79332c113, type: 3}
|
- {fileID: 102900000, guid: 60ac19fbbe20cec48add96b79332c113, type: 3}
|
||||||
FilterEnum: 0
|
FilterEnum: 0
|
||||||
Filter: '*'
|
Filter: '*'
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/chwytak.prefab
|
|
||||||
Address: Plyaer/chwytak
|
|
||||||
Type: GameObject
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Material/ekran.mat
|
|
||||||
Address: Plyaer/ekran
|
|
||||||
Type: Material
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Material/hak.mat
|
|
||||||
Address: Plyaer/hak
|
|
||||||
Type: Material
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Material/panel.mat
|
|
||||||
Address: Plyaer/panel
|
|
||||||
Type: Material
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Material/plastik.mat
|
|
||||||
Address: Plyaer/plastik
|
|
||||||
Type: Material
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Material/uchwyt.mat
|
|
||||||
Address: Plyaer/uchwyt
|
|
||||||
Type: Material
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/Box001_18.mesh
|
|
||||||
Address: Plyaer/Box001_18
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/Box002_6.mesh
|
|
||||||
Address: Plyaer/Box002_6
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/Box003_0.mesh
|
|
||||||
Address: Plyaer/Box003_0
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/Cylinder001_7.mesh
|
|
||||||
Address: Plyaer/Cylinder001_7
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/ekran.mesh
|
|
||||||
Address: Plyaer/ekran
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/srubka 2.mesh
|
|
||||||
Address: Plyaer/srubka 2
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Mesh/Tube001_0.mesh
|
|
||||||
Address: Plyaer/Tube001_0
|
|
||||||
Type: Mesh
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_ekran_MetallicSmoothness.png
|
|
||||||
Address: Plyaer/chwytak ufs_ekran_MetallicSmoothness
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_hak_AlbedoTransparency.png
|
|
||||||
Address: Plyaer/chwytak ufs_hak_AlbedoTransparency
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_hak_MetallicSmoothness.png
|
|
||||||
Address: Plyaer/chwytak ufs_hak_MetallicSmoothness
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_hak_Normal.png
|
|
||||||
Address: Plyaer/chwytak ufs_hak_Normal
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_panel_AlbedoTransparency.png
|
|
||||||
Address: Plyaer/chwytak ufs_panel_AlbedoTransparency
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_panel_MetallicSmoothness.png
|
|
||||||
Address: Plyaer/chwytak ufs_panel_MetallicSmoothness
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_panel_Normal.png
|
|
||||||
Address: Plyaer/chwytak ufs_panel_Normal
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_plastik_AlbedoTransparency.png
|
|
||||||
Address: Plyaer/chwytak ufs_plastik_AlbedoTransparency
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_plastik_MetallicSmoothness.png
|
|
||||||
Address: Plyaer/chwytak ufs_plastik_MetallicSmoothness
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_plastik_Normal.png
|
|
||||||
Address: Plyaer/chwytak ufs_plastik_Normal
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/chwytak ufs_uchwyt_Normal.png
|
|
||||||
Address: Plyaer/chwytak ufs_uchwyt_Normal
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/chwytak/Texture2D/kategoria selected.png
|
|
||||||
Address: Plyaer/kategoria selected
|
|
||||||
Type: Texture2D
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/FFishingLine_0.prefab
|
|
||||||
Address: Plyaer/FFishingLine_0
|
|
||||||
Type: GameObject
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/FFishingLine_1.prefab
|
|
||||||
Address: Plyaer/FFishingLine_1
|
|
||||||
Type: GameObject
|
|
||||||
Bundle: main/plyaer.bundle
|
|
||||||
Tags:
|
|
||||||
Group:
|
|
||||||
Name: Plyaer
|
|
||||||
Enable: 1
|
|
||||||
BundleMode: 0
|
|
||||||
AddressMode: 2
|
|
||||||
Tags:
|
|
||||||
Collectors:
|
|
||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
|
||||||
FilterEnum: 0
|
|
||||||
Filter: '*'
|
|
||||||
- Path: Assets/ResRaw/Prefabs/Line/fishing line float set.prefab
|
- Path: Assets/ResRaw/Prefabs/Line/fishing line float set.prefab
|
||||||
Address: Plyaer/fishing line float set
|
Address: Plyaer/fishing line float set
|
||||||
Type: GameObject
|
Type: GameObject
|
||||||
@@ -19078,6 +18673,21 @@ MonoBehaviour:
|
|||||||
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||||
FilterEnum: 0
|
FilterEnum: 0
|
||||||
Filter: '*'
|
Filter: '*'
|
||||||
|
- Path: Assets/ResRaw/Prefabs/Line/FishingRopeLong2.asset
|
||||||
|
Address: Plyaer/FishingRopeLong2
|
||||||
|
Type: ObiRopeBlueprint
|
||||||
|
Bundle: main/plyaer.bundle
|
||||||
|
Tags:
|
||||||
|
Group:
|
||||||
|
Name: Plyaer
|
||||||
|
Enable: 1
|
||||||
|
BundleMode: 0
|
||||||
|
AddressMode: 2
|
||||||
|
Tags:
|
||||||
|
Collectors:
|
||||||
|
- {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3}
|
||||||
|
FilterEnum: 0
|
||||||
|
Filter: '*'
|
||||||
- Path: Assets/ResRaw/Prefabs/Line/FishingRopeShort.asset
|
- Path: Assets/ResRaw/Prefabs/Line/FishingRopeShort.asset
|
||||||
Address: Plyaer/FishingRopeShort
|
Address: Plyaer/FishingRopeShort
|
||||||
Type: ObiRopeBlueprint
|
Type: ObiRopeBlueprint
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 5cbac6e678443724c9bd2baf5d564c1d, type: 3}
|
m_Script: {fileID: 11500000, guid: 5cbac6e678443724c9bd2baf5d564c1d, type: 3}
|
||||||
m_Name: Clear Sky
|
m_Name: Clear Sky
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
showEditor: 0
|
showEditor: 1
|
||||||
showEffectControls: 0
|
showEffectControls: 0
|
||||||
showCloudControls: 0
|
showCloudControls: 0
|
||||||
showFlatCloudControls: 1
|
showFlatCloudControls: 1
|
||||||
showFogControls: 0
|
showFogControls: 0
|
||||||
showSkyControls: 1
|
showSkyControls: 0
|
||||||
showLightingControls: 0
|
showLightingControls: 0
|
||||||
showAuroraControls: 0
|
showAuroraControls: 0
|
||||||
showEnvironmentControls: 0
|
showEnvironmentControls: 1
|
||||||
showAudioControls: 0
|
showAudioControls: 0
|
||||||
showAmbientAudioControls: 0
|
showAmbientAudioControls: 0
|
||||||
showWeatherAudioControls: 0
|
showWeatherAudioControls: 0
|
||||||
@@ -118,7 +118,7 @@ MonoBehaviour:
|
|||||||
temperatureWeatherMod: 0
|
temperatureWeatherMod: 0
|
||||||
wetnessTarget: 0
|
wetnessTarget: 0
|
||||||
snowTarget: 0
|
snowTarget: 0
|
||||||
windDirectionX: 1
|
windDirectionX: -1
|
||||||
windDirectionY: 0
|
windDirectionY: -1
|
||||||
windSpeed: 0.25
|
windSpeed: 1
|
||||||
windTurbulence: 0.25
|
windTurbulence: 0
|
||||||
|
|||||||
6227
Assets/ResRaw/Prefabs/Line/FishingRopeLong2.asset
Normal file
6227
Assets/ResRaw/Prefabs/Line/FishingRopeLong2.asset
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/ResRaw/Prefabs/Line/FishingRopeLong2.asset.meta
Normal file
8
Assets/ResRaw/Prefabs/Line/FishingRopeLong2.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 90165a559e0af984497f40ee19419ea5
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -316,7 +316,7 @@ MonoBehaviour:
|
|||||||
_aerodynamicsEnabled: 1
|
_aerodynamicsEnabled: 1
|
||||||
_drag: 0.05
|
_drag: 0.05
|
||||||
_lift: 0.02
|
_lift: 0.02
|
||||||
m_RopeBlueprint: {fileID: 11400000, guid: c29a67f2195883840b049b2c2a54a55c, type: 2}
|
m_RopeBlueprint: {fileID: 11400000, guid: 90165a559e0af984497f40ee19419ea5, type: 2}
|
||||||
tearingEnabled: 0
|
tearingEnabled: 0
|
||||||
tearResistanceMultiplier: 1000
|
tearResistanceMultiplier: 1000
|
||||||
tearRate: 1
|
tearRate: 1
|
||||||
@@ -325,9 +325,9 @@ MonoBehaviour:
|
|||||||
_stretchCompliance: 0
|
_stretchCompliance: 0
|
||||||
_maxCompression: 0
|
_maxCompression: 0
|
||||||
_bendConstraintsEnabled: 1
|
_bendConstraintsEnabled: 1
|
||||||
_bendCompliance: 0
|
_bendCompliance: 0.5
|
||||||
_maxBending: 0.05
|
_maxBending: 0.5
|
||||||
_plasticYield: 0
|
_plasticYield: 0.1
|
||||||
_plasticCreep: 0
|
_plasticCreep: 0
|
||||||
--- !u!23 &23649574223012002
|
--- !u!23 &23649574223012002
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
@@ -413,7 +413,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c4747da60837c44f9ba4b4a86879bcc8, type: 3}
|
m_Script: {fileID: 11500000, guid: c4747da60837c44f9ba4b4a86879bcc8, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
material: {fileID: 0}
|
material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
renderParameters:
|
renderParameters:
|
||||||
layer: 0
|
layer: 0
|
||||||
lightProbeUsage: 1
|
lightProbeUsage: 1
|
||||||
@@ -441,7 +441,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Actor: {fileID: 114612983243751934}
|
m_Actor: {fileID: 114612983243751934}
|
||||||
m_Target: {fileID: 0}
|
m_Target: {fileID: 0}
|
||||||
m_ParticleGroup: {fileID: -5395693579433732326, guid: c29a67f2195883840b049b2c2a54a55c, type: 2}
|
m_ParticleGroup: {fileID: 5356683708585918033, guid: 90165a559e0af984497f40ee19419ea5, type: 2}
|
||||||
m_AttachmentType: 0
|
m_AttachmentType: 0
|
||||||
m_ConstrainOrientation: 0
|
m_ConstrainOrientation: 0
|
||||||
m_Projection: 0
|
m_Projection: 0
|
||||||
@@ -461,7 +461,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Actor: {fileID: 114612983243751934}
|
m_Actor: {fileID: 114612983243751934}
|
||||||
m_Target: {fileID: 4530253318796540}
|
m_Target: {fileID: 4530253318796540}
|
||||||
m_ParticleGroup: {fileID: -2515171973132415257, guid: c29a67f2195883840b049b2c2a54a55c, type: 2}
|
m_ParticleGroup: {fileID: -6506362155496508246, guid: 90165a559e0af984497f40ee19419ea5, type: 2}
|
||||||
m_AttachmentType: 0
|
m_AttachmentType: 0
|
||||||
m_ConstrainOrientation: 0
|
m_ConstrainOrientation: 0
|
||||||
m_Projection: 0
|
m_Projection: 0
|
||||||
@@ -550,7 +550,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 1035052809208993}
|
m_GameObject: {fileID: 1035052809208993}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: -1, z: 0}
|
m_LocalPosition: {x: 0, y: -1.5, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -804,7 +804,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 1858052053854210}
|
m_GameObject: {fileID: 1858052053854210}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: -0.5, z: 0}
|
m_LocalPosition: {x: 0, y: -1, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -988,7 +988,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 1933124697579601}
|
m_GameObject: {fileID: 1933124697579601}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: -0.5, z: 0}
|
m_LocalPosition: {x: 0, y: -1, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -1148,9 +1148,9 @@ MonoBehaviour:
|
|||||||
_stretchCompliance: 0
|
_stretchCompliance: 0
|
||||||
_maxCompression: 0
|
_maxCompression: 0
|
||||||
_bendConstraintsEnabled: 1
|
_bendConstraintsEnabled: 1
|
||||||
_bendCompliance: 0
|
_bendCompliance: 0.5
|
||||||
_maxBending: 0.05
|
_maxBending: 0.5
|
||||||
_plasticYield: 0
|
_plasticYield: 0.1
|
||||||
_plasticCreep: 0
|
_plasticCreep: 0
|
||||||
--- !u!23 &23047835326758575
|
--- !u!23 &23047835326758575
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
@@ -1236,7 +1236,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c4747da60837c44f9ba4b4a86879bcc8, type: 3}
|
m_Script: {fileID: 11500000, guid: c4747da60837c44f9ba4b4a86879bcc8, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
material: {fileID: 0}
|
material: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
renderParameters:
|
renderParameters:
|
||||||
layer: 0
|
layer: 0
|
||||||
lightProbeUsage: 1
|
lightProbeUsage: 1
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -144,5 +144,15 @@ namespace NBF
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 线断了
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
/// <param name="loseBaitChance"></param>
|
||||||
|
public void LineBreak(string msg, float loseBaitChance)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,12 +49,12 @@ namespace NBF
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 线长度
|
/// 线长度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float lineLength = 1;
|
public float lineLength = 1.5f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 浮漂线长度
|
/// 浮漂线长度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float floatLength = 0.1f;
|
public float floatLength = 0.5f;
|
||||||
|
|
||||||
public float Tension
|
public float Tension
|
||||||
{
|
{
|
||||||
|
|||||||
8
Assets/Scripts/PhysicsTools.meta
Normal file
8
Assets/Scripts/PhysicsTools.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 47fc822e51a6b074bb4b6bd67e69a457
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
176
Assets/Scripts/PhysicsTools/Bezier.cs
Normal file
176
Assets/Scripts/PhysicsTools/Bezier.cs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
public class Bezier
|
||||||
|
{
|
||||||
|
private Vector3[] knots;
|
||||||
|
|
||||||
|
private Vector3[] firstControlPts;
|
||||||
|
|
||||||
|
private Vector3[] secondControlPts;
|
||||||
|
|
||||||
|
private int lastIndex = 1;
|
||||||
|
|
||||||
|
private float lengthCovered;
|
||||||
|
|
||||||
|
private float indexedLength;
|
||||||
|
|
||||||
|
private float totalLength;
|
||||||
|
|
||||||
|
public Bezier(List<PosOri> points)
|
||||||
|
{
|
||||||
|
Vector3[] array = new Vector3[points.Count];
|
||||||
|
for (int i = 0; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
array[i] = points[i].pos;
|
||||||
|
}
|
||||||
|
init(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bezier(Vector3[] points)
|
||||||
|
{
|
||||||
|
init(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(Vector3[] points)
|
||||||
|
{
|
||||||
|
knots = new Vector3[points.Length];
|
||||||
|
for (int i = 0; i < points.Length; i++)
|
||||||
|
{
|
||||||
|
knots[i] = points[i];
|
||||||
|
if (i != 0)
|
||||||
|
{
|
||||||
|
totalLength += (knots[i] - knots[i - 1]).magnitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GetCurveControlPoints(knots, out firstControlPts, out secondControlPts);
|
||||||
|
indexedLength = (knots[1] - knots[0]).magnitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float TotalLength()
|
||||||
|
{
|
||||||
|
return totalLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PosOri getNext(float deltaLen)
|
||||||
|
{
|
||||||
|
return new PosOri(getNextPos(deltaLen), Quaternion.identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 getNextPos(float deltaLen)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
float num = indexedLength;
|
||||||
|
float num2 = indexedLength;
|
||||||
|
while (!flag)
|
||||||
|
{
|
||||||
|
num = indexedLength;
|
||||||
|
num2 = indexedLength - (knots[lastIndex] - knots[lastIndex - 1]).magnitude;
|
||||||
|
if (lengthCovered + deltaLen > num)
|
||||||
|
{
|
||||||
|
lastIndex++;
|
||||||
|
if (lastIndex == knots.Length)
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
deltaLen = num - lengthCovered;
|
||||||
|
lastIndex = knots.Length - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
indexedLength += (knots[lastIndex] - knots[lastIndex - 1]).magnitude;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float num3 = (lengthCovered + deltaLen - num2) / (num - num2);
|
||||||
|
Vector3 result = (float)Math.Pow(1f - num3, 3.0) * knots[lastIndex - 1] + 3f * (float)Math.Pow(1f - num3, 2.0) * num3 * firstControlPts[lastIndex - 1] + 3f * (1f - num3) * num3 * num3 * secondControlPts[lastIndex - 1] + num3 * num3 * num3 * knots[lastIndex];
|
||||||
|
lengthCovered += deltaLen;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetCurveControlPoints(Vector3[] knots, out Vector3[] firstControlPoints, out Vector3[] secondControlPoints)
|
||||||
|
{
|
||||||
|
if (knots == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("knots");
|
||||||
|
}
|
||||||
|
int num = knots.Length - 1;
|
||||||
|
if (num < 1)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("At least two knot points required", "knots");
|
||||||
|
}
|
||||||
|
if (num == 1)
|
||||||
|
{
|
||||||
|
firstControlPoints = new Vector3[1];
|
||||||
|
firstControlPoints[0].x = (2f * knots[0].x + knots[1].x) / 3f;
|
||||||
|
firstControlPoints[0].y = (2f * knots[0].y + knots[1].y) / 3f;
|
||||||
|
firstControlPoints[0].z = (2f * knots[0].z + knots[1].z) / 3f;
|
||||||
|
secondControlPoints = new Vector3[1];
|
||||||
|
secondControlPoints[0].x = 2f * firstControlPoints[0].x - knots[0].x;
|
||||||
|
secondControlPoints[0].y = 2f * firstControlPoints[0].y - knots[0].y;
|
||||||
|
secondControlPoints[0].z = 2f * firstControlPoints[0].z - knots[0].z;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float[] array = new float[num];
|
||||||
|
for (int i = 1; i < num - 1; i++)
|
||||||
|
{
|
||||||
|
array[i] = 4f * knots[i].x + 2f * knots[i + 1].x;
|
||||||
|
}
|
||||||
|
array[0] = knots[0].x + 2f * knots[1].x;
|
||||||
|
array[num - 1] = (8f * knots[num - 1].x + knots[num].x) / 2f;
|
||||||
|
float[] firstControlPoints2 = GetFirstControlPoints(array);
|
||||||
|
for (int j = 1; j < num - 1; j++)
|
||||||
|
{
|
||||||
|
array[j] = 4f * knots[j].y + 2f * knots[j + 1].y;
|
||||||
|
}
|
||||||
|
array[0] = knots[0].y + 2f * knots[1].y;
|
||||||
|
array[num - 1] = (8f * knots[num - 1].y + knots[num].y) / 2f;
|
||||||
|
float[] firstControlPoints3 = GetFirstControlPoints(array);
|
||||||
|
for (int k = 1; k < num - 1; k++)
|
||||||
|
{
|
||||||
|
array[k] = 4f * knots[k].z + 2f * knots[k + 1].z;
|
||||||
|
}
|
||||||
|
array[0] = knots[0].z + 2f * knots[1].z;
|
||||||
|
array[num - 1] = (8f * knots[num - 1].z + knots[num].z) / 2f;
|
||||||
|
float[] firstControlPoints4 = GetFirstControlPoints(array);
|
||||||
|
firstControlPoints = new Vector3[num];
|
||||||
|
secondControlPoints = new Vector3[num];
|
||||||
|
for (int l = 0; l < num; l++)
|
||||||
|
{
|
||||||
|
firstControlPoints[l] = new Vector3(firstControlPoints2[l], firstControlPoints3[l], firstControlPoints4[l]);
|
||||||
|
if (l < num - 1)
|
||||||
|
{
|
||||||
|
secondControlPoints[l] = new Vector3(2f * knots[l + 1].x - firstControlPoints2[l + 1], 2f * knots[l + 1].y - firstControlPoints3[l + 1], 2f * knots[l + 1].z - firstControlPoints4[l + 1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
secondControlPoints[l] = new Vector3((knots[num].x + firstControlPoints2[num - 1]) / 2f, (knots[num].y + firstControlPoints3[num - 1]) / 2f, (knots[num].z + firstControlPoints4[num - 1]) / 2f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float[] GetFirstControlPoints(float[] rhs)
|
||||||
|
{
|
||||||
|
int num = rhs.Length;
|
||||||
|
float[] array = new float[num];
|
||||||
|
float[] array2 = new float[num];
|
||||||
|
float num2 = 2f;
|
||||||
|
array[0] = rhs[0] / num2;
|
||||||
|
for (int i = 1; i < num; i++)
|
||||||
|
{
|
||||||
|
array2[i] = 1f / num2;
|
||||||
|
num2 = ((i >= num - 1) ? 3.5f : 4f) - array2[i];
|
||||||
|
array[i] = (rhs[i] - array[i - 1]) / num2;
|
||||||
|
}
|
||||||
|
for (int j = 1; j < num; j++)
|
||||||
|
{
|
||||||
|
array[num - j - 1] -= array2[num - j] * array[num - j];
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/Bezier.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/Bezier.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c65206b6e7283d4396bb4c47f4ddf88
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Scripts/PhysicsTools/BoneSegment.cs
Normal file
18
Assets/Scripts/PhysicsTools/BoneSegment.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
internal class BoneSegment : Segment
|
||||||
|
{
|
||||||
|
public GameObject bone;
|
||||||
|
|
||||||
|
public Matrix4x4 initTransform;
|
||||||
|
|
||||||
|
public BoneSegment(string name, float len, Vector3 pos, Quaternion q, SegmentPropertiesBase segProperties, Rope r, GameObject b)
|
||||||
|
: base(name, len, pos, q, segProperties, r)
|
||||||
|
{
|
||||||
|
bone = b;
|
||||||
|
initTransform = seg.transform.worldToLocalMatrix * bone.transform.localToWorldMatrix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/BoneSegment.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/BoneSegment.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 265d31d4ce3243c4cadb3a8ba8c80dae
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
62
Assets/Scripts/PhysicsTools/ControlPoint.cs
Normal file
62
Assets/Scripts/PhysicsTools/ControlPoint.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class ControlPoint
|
||||||
|
{
|
||||||
|
[Tooltip("Optional: Object")]
|
||||||
|
public GameObject obj;
|
||||||
|
|
||||||
|
[Tooltip("Position through which rope will pass... If Object is specified then it is the local to the object otherwise it is global position")]
|
||||||
|
public Vector3 localPos;
|
||||||
|
|
||||||
|
[Range(1f, 5f)]
|
||||||
|
[Tooltip("SlackFraction: How much of the rope length should be created between two control points... If it is more than 1 then a catenary is formed between the control points")]
|
||||||
|
public float slackFraction;
|
||||||
|
|
||||||
|
[Tooltip("Specify whether it is attached to the control point or not")]
|
||||||
|
public bool attached;
|
||||||
|
|
||||||
|
public ControlPoint()
|
||||||
|
{
|
||||||
|
obj = null;
|
||||||
|
slackFraction = 1f;
|
||||||
|
attached = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return ((!(obj != null)) ? "Object: null" : ("Object:" + obj.ToString())) + ", Position: " + localPos.ToString() + ", SlackFraction: " + slackFraction + ", Attached: " + attached;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool compare(ControlPoint rhs)
|
||||||
|
{
|
||||||
|
if (obj != rhs.obj || localPos != rhs.localPos || slackFraction != rhs.slackFraction || attached != rhs.attached)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlPoint clone()
|
||||||
|
{
|
||||||
|
ControlPoint controlPoint = new ControlPoint();
|
||||||
|
controlPoint.obj = obj;
|
||||||
|
controlPoint.localPos = localPos;
|
||||||
|
controlPoint.slackFraction = slackFraction;
|
||||||
|
controlPoint.attached = attached;
|
||||||
|
return controlPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 globalPos(Rope rope)
|
||||||
|
{
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
return obj.transform.TransformPoint(localPos);
|
||||||
|
}
|
||||||
|
return rope.transform.TransformPoint(localPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/Scripts/PhysicsTools/ControlPoint.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/ControlPoint.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4c3919bd67247ecf47ac8b5970b70372
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
142
Assets/Scripts/PhysicsTools/Joint.cs
Normal file
142
Assets/Scripts/PhysicsTools/Joint.cs
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
public class Joint
|
||||||
|
{
|
||||||
|
public UnityEngine.Joint joint;
|
||||||
|
|
||||||
|
public Joint(Segment seg1, Segment seg2, JointProperties prop, SegmentPropertiesBase segProperties, Quaternion twistOffset)
|
||||||
|
{
|
||||||
|
if (seg2 == null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
seg2.seg.transform.rotation = seg2.seg.transform.rotation * twistOffset;
|
||||||
|
switch (prop.type)
|
||||||
|
{
|
||||||
|
case JointProperties.Type.HINGE_JOINT:
|
||||||
|
{
|
||||||
|
HingeJoint hingeJoint = seg1.seg.AddComponent<HingeJoint>();
|
||||||
|
hingeJoint.autoConfigureConnectedAnchor = false;
|
||||||
|
joint = hingeJoint;
|
||||||
|
JointLimits limits = new JointLimits
|
||||||
|
{
|
||||||
|
min = 0f - prop.swingLimitDeg,
|
||||||
|
max = prop.swingLimitDeg
|
||||||
|
};
|
||||||
|
joint.axis = new Vector3(0f, 0f, 1f);
|
||||||
|
hingeJoint.limits = limits;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case JointProperties.Type.CONFIGURABLE_JOINT:
|
||||||
|
{
|
||||||
|
ConfigurableJoint configurableJoint = seg1.seg.AddComponent<ConfigurableJoint>();
|
||||||
|
configurableJoint.enableCollision = false;
|
||||||
|
configurableJoint.xMotion = ConfigurableJointMotion.Locked;
|
||||||
|
configurableJoint.yMotion = ConfigurableJointMotion.Locked;
|
||||||
|
configurableJoint.zMotion = ConfigurableJointMotion.Locked;
|
||||||
|
configurableJoint.angularXMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.angularYMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.angularZMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.autoConfigureConnectedAnchor = false;
|
||||||
|
configurableJoint.lowAngularXLimit = new SoftJointLimit
|
||||||
|
{
|
||||||
|
limit = 0f - prop.twistLimitDeg
|
||||||
|
};
|
||||||
|
configurableJoint.highAngularXLimit = new SoftJointLimit
|
||||||
|
{
|
||||||
|
limit = prop.twistLimitDeg
|
||||||
|
};
|
||||||
|
configurableJoint.projectionMode = JointProjectionMode.PositionAndRotation;
|
||||||
|
configurableJoint.projectionDistance = prop.projectionDistance;
|
||||||
|
SoftJointLimit softJointLimit = new SoftJointLimit
|
||||||
|
{
|
||||||
|
limit = prop.swingLimitDeg
|
||||||
|
};
|
||||||
|
configurableJoint.angularYLimit = softJointLimit;
|
||||||
|
configurableJoint.angularZLimit = softJointLimit;
|
||||||
|
joint = configurableJoint;
|
||||||
|
joint.axis = new Vector3(0f, 1f, 0f);
|
||||||
|
if (prop.breakingForce != 0f)
|
||||||
|
{
|
||||||
|
configurableJoint.breakForce = prop.breakingForce;
|
||||||
|
}
|
||||||
|
configurableJoint.enablePreprocessing = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (segProperties is SegmentPropertiesCylinder)
|
||||||
|
{
|
||||||
|
joint.anchor = new Vector3(0f, 1f - prop.offsetScale, 0f);
|
||||||
|
joint.connectedAnchor = new Vector3(0f, -1f + prop.offsetScale, 0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
joint.anchor = new Vector3(0f, (1f - prop.offsetScale) / 2f, 0f);
|
||||||
|
joint.connectedAnchor = new Vector3(0f, (-1f + prop.offsetScale) / 2f, 0f);
|
||||||
|
}
|
||||||
|
joint.connectedBody = seg2.seg.GetComponent<Rigidbody>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Joint(GameObject seg1, GameObject seg2, Vector3 vGlobalAnchor, Vector3 vGlobalAxis, JointProperties prop, Rope r, int jtPos)
|
||||||
|
{
|
||||||
|
ConfigurableJoint configurableJoint = seg1.AddComponent<ConfigurableJoint>();
|
||||||
|
configurableJoint.enableCollision = false;
|
||||||
|
configurableJoint.xMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.yMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.zMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.angularXMotion = ConfigurableJointMotion.Limited;
|
||||||
|
configurableJoint.angularYMotion = ConfigurableJointMotion.Free;
|
||||||
|
configurableJoint.angularZMotion = ConfigurableJointMotion.Free;
|
||||||
|
configurableJoint.anchor = seg1.transform.InverseTransformPoint(vGlobalAnchor);
|
||||||
|
configurableJoint.axis = seg1.transform.InverseTransformDirection(vGlobalAxis);
|
||||||
|
if (seg2 != null)
|
||||||
|
{
|
||||||
|
configurableJoint.connectedBody = seg2.GetComponent<Rigidbody>();
|
||||||
|
}
|
||||||
|
SoftJointLimit linearLimit = new SoftJointLimit
|
||||||
|
{
|
||||||
|
limit = 0.01f
|
||||||
|
};
|
||||||
|
SoftJointLimitSpring linearLimitSpring = default(SoftJointLimitSpring);
|
||||||
|
switch (jtPos)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
linearLimitSpring = r.getStartJtSpring();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
linearLimitSpring = r.getEndJtSpring();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
float damper = (linearLimitSpring.spring = 0f);
|
||||||
|
linearLimitSpring.damper = damper;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (linearLimitSpring.spring == 0f)
|
||||||
|
{
|
||||||
|
linearLimit.limit = 0f;
|
||||||
|
}
|
||||||
|
configurableJoint.linearLimitSpring = linearLimitSpring;
|
||||||
|
configurableJoint.linearLimit = linearLimit;
|
||||||
|
configurableJoint.projectionMode = JointProjectionMode.PositionAndRotation;
|
||||||
|
configurableJoint.projectionDistance = prop.projectionDistanceFirst;
|
||||||
|
configurableJoint.lowAngularXLimit = new SoftJointLimit
|
||||||
|
{
|
||||||
|
limit = 0f - prop.twistLimitDeg
|
||||||
|
};
|
||||||
|
configurableJoint.highAngularXLimit = new SoftJointLimit
|
||||||
|
{
|
||||||
|
limit = prop.twistLimitDeg
|
||||||
|
};
|
||||||
|
if (prop.breakingForce != 0f)
|
||||||
|
{
|
||||||
|
configurableJoint.breakForce = prop.breakingForce;
|
||||||
|
}
|
||||||
|
joint = configurableJoint;
|
||||||
|
configurableJoint.autoConfigureConnectedAnchor = false;
|
||||||
|
configurableJoint.enablePreprocessing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/Scripts/PhysicsTools/Joint.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/Joint.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3e680fa725d3066a2472a42dc6f1ba88
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
48
Assets/Scripts/PhysicsTools/JointProperties.cs
Normal file
48
Assets/Scripts/PhysicsTools/JointProperties.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class JointProperties
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
CONFIGURABLE_JOINT = 0,
|
||||||
|
HINGE_JOINT = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type type;
|
||||||
|
|
||||||
|
[Range(0f, 180f)]
|
||||||
|
public float twistLimitDeg;
|
||||||
|
|
||||||
|
[Range(0f, 180f)]
|
||||||
|
public float swingLimitDeg;
|
||||||
|
|
||||||
|
[Range(0f, 0.5f)]
|
||||||
|
public float offsetScale;
|
||||||
|
|
||||||
|
[Range(0f, 90f)]
|
||||||
|
public float twistOffsetDeg;
|
||||||
|
|
||||||
|
public float breakingForce;
|
||||||
|
|
||||||
|
public float projectionDistance;
|
||||||
|
|
||||||
|
public float projectionDistanceFirst;
|
||||||
|
|
||||||
|
public JointProperties()
|
||||||
|
{
|
||||||
|
type = Type.CONFIGURABLE_JOINT;
|
||||||
|
twistLimitDeg = 10f;
|
||||||
|
swingLimitDeg = 50f;
|
||||||
|
offsetScale = 0f;
|
||||||
|
twistOffsetDeg = 0f;
|
||||||
|
breakingForce = 0f;
|
||||||
|
projectionDistance = 0.1f;
|
||||||
|
projectionDistanceFirst = 0.001f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/JointProperties.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/JointProperties.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a0a2d569b86ab9e4f96ae4345b0340de
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
89
Assets/Scripts/PhysicsTools/LinkMesh.cs
Normal file
89
Assets/Scripts/PhysicsTools/LinkMesh.cs
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class LinkMesh
|
||||||
|
{
|
||||||
|
[HideInInspector]
|
||||||
|
public Mesh modifiedMesh;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Matrix4x4 transform;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Mesh defaultMesh;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Material defaultMeshMaterial;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Matrix4x4 defaultTransform;
|
||||||
|
|
||||||
|
public Mesh mesh;
|
||||||
|
|
||||||
|
public Material meshMaterial;
|
||||||
|
|
||||||
|
public Vector3 position;
|
||||||
|
|
||||||
|
public Vector3 rotation;
|
||||||
|
|
||||||
|
public Vector3 scale;
|
||||||
|
|
||||||
|
public LinkMesh()
|
||||||
|
{
|
||||||
|
mesh = null;
|
||||||
|
position = new Vector3(0f, 0f, 0f);
|
||||||
|
rotation = new Vector3(0f, 0f, 0f);
|
||||||
|
scale = new Vector3(1f, 1f, 1f);
|
||||||
|
defaultTransform = default(Matrix4x4);
|
||||||
|
defaultTransform.SetTRS(position, Quaternion.Euler(rotation), scale);
|
||||||
|
transform = default(Matrix4x4);
|
||||||
|
transform.SetTRS(position, Quaternion.Euler(rotation), scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
if (mesh == null)
|
||||||
|
{
|
||||||
|
mesh = defaultMesh;
|
||||||
|
transform = defaultTransform;
|
||||||
|
Quaternion rot;
|
||||||
|
Utility.MatrixToTRS(transform, out position, out rot, out scale);
|
||||||
|
rotation = rot.eulerAngles;
|
||||||
|
}
|
||||||
|
if (mesh != null)
|
||||||
|
{
|
||||||
|
modifiedMesh = UnityEngine.Object.Instantiate(mesh);
|
||||||
|
}
|
||||||
|
if (modifiedMesh != null)
|
||||||
|
{
|
||||||
|
transform.SetTRS(position, Quaternion.Euler(rotation), scale);
|
||||||
|
ScaleMesh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ScaleMesh()
|
||||||
|
{
|
||||||
|
Vector3[] vertices = modifiedMesh.vertices;
|
||||||
|
for (int i = 0; i < vertices.Length; i++)
|
||||||
|
{
|
||||||
|
Vector3 point = vertices[i];
|
||||||
|
point = transform.MultiplyPoint(point);
|
||||||
|
vertices[i] = point;
|
||||||
|
}
|
||||||
|
modifiedMesh.vertices = vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mesh getMesh()
|
||||||
|
{
|
||||||
|
return modifiedMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Material getMaterial()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/Scripts/PhysicsTools/LinkMesh.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/LinkMesh.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 88218b6dac3a1d87d3867523046c804d
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
19
Assets/Scripts/PhysicsTools/PosOri.cs
Normal file
19
Assets/Scripts/PhysicsTools/PosOri.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class PosOri
|
||||||
|
{
|
||||||
|
public Vector3 pos;
|
||||||
|
|
||||||
|
public Quaternion rot;
|
||||||
|
|
||||||
|
public PosOri(Vector3 p, Quaternion q)
|
||||||
|
{
|
||||||
|
pos = p;
|
||||||
|
rot = q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/PosOri.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/PosOri.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0da6209e0750de846b70cb074a64d5bc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
1530
Assets/Scripts/PhysicsTools/Rope.cs
Normal file
1530
Assets/Scripts/PhysicsTools/Rope.cs
Normal file
File diff suppressed because it is too large
Load Diff
14
Assets/Scripts/PhysicsTools/Rope.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/Rope.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8d8b3d7293da4ed8736330164944ddd3
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
26
Assets/Scripts/PhysicsTools/SCapsulePos.cs
Normal file
26
Assets/Scripts/PhysicsTools/SCapsulePos.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
internal class SCapsulePos
|
||||||
|
{
|
||||||
|
public Vector3 vPos;
|
||||||
|
|
||||||
|
public Vector3 vDir;
|
||||||
|
|
||||||
|
public Vector3 vPrevPos;
|
||||||
|
|
||||||
|
public Vector3 vPrevDir;
|
||||||
|
|
||||||
|
public float fLen;
|
||||||
|
|
||||||
|
public SCapsulePos()
|
||||||
|
{
|
||||||
|
vPos = new Vector3(0f, 0f, 0f);
|
||||||
|
vDir = new Vector3(0f, 0f, 0f);
|
||||||
|
vPrevPos = new Vector3(0f, 0f, 0f);
|
||||||
|
vPrevDir = new Vector3(0f, 0f, 0f);
|
||||||
|
fLen = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/SCapsulePos.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/SCapsulePos.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3881b5b71590e5142bc7910fe64dbc69
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
58
Assets/Scripts/PhysicsTools/Segment.cs
Normal file
58
Assets/Scripts/PhysicsTools/Segment.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
// using UltimateWater;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
public class Segment
|
||||||
|
{
|
||||||
|
public GameObject seg;
|
||||||
|
|
||||||
|
public Rigidbody body;
|
||||||
|
|
||||||
|
public Joint prev;
|
||||||
|
|
||||||
|
public Joint next;
|
||||||
|
|
||||||
|
public CapsuleCollider capsuleCollider;
|
||||||
|
|
||||||
|
public MeshFilter meshFilter;
|
||||||
|
|
||||||
|
public MeshRenderer meshRenderer;
|
||||||
|
|
||||||
|
// public WaterInteractive waterInteractive;
|
||||||
|
|
||||||
|
public Segment(string name, float len, Vector3 pos, Quaternion q, SegmentPropertiesBase segProperties, Rope r)
|
||||||
|
{
|
||||||
|
SegmentPropertiesCylinder segmentPropertiesCylinder = (SegmentPropertiesCylinder)segProperties;
|
||||||
|
float radius = segmentPropertiesCylinder.radius;
|
||||||
|
seg = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
|
||||||
|
capsuleCollider = seg.GetComponent<CapsuleCollider>();
|
||||||
|
meshFilter = seg.GetComponent<MeshFilter>();
|
||||||
|
meshRenderer = seg.GetComponent<MeshRenderer>();
|
||||||
|
body = seg.AddComponent<Rigidbody>();
|
||||||
|
capsuleCollider.sharedMaterial = r.ropeMaterial;
|
||||||
|
capsuleCollider.enabled = r.useColliders;
|
||||||
|
r.lstComponentsCreated.Add(seg);
|
||||||
|
seg.hideFlags = (r.HideChildren ? HideFlags.HideInHierarchy : HideFlags.None);
|
||||||
|
meshRenderer.enabled = true;
|
||||||
|
r.linkMesh.defaultMesh = meshFilter.sharedMesh;
|
||||||
|
r.linkMesh.defaultMeshMaterial = meshRenderer.sharedMaterial;
|
||||||
|
r.linkMesh.defaultTransform = Matrix4x4.identity;
|
||||||
|
if (r.linkMesh.getMesh() != null)
|
||||||
|
{
|
||||||
|
meshFilter.sharedMesh = r.linkMesh.getMesh();
|
||||||
|
meshRenderer.sharedMaterial = r.linkMesh.meshMaterial;
|
||||||
|
}
|
||||||
|
seg.name = name;
|
||||||
|
seg.transform.localScale = new Vector3(radius * 2f, len / 2f, radius * 2f);
|
||||||
|
seg.transform.localPosition = pos;
|
||||||
|
seg.transform.localRotation = q;
|
||||||
|
body.maxAngularVelocity = 1f;
|
||||||
|
body.angularDamping = segmentPropertiesCylinder.angularDamping;
|
||||||
|
body.linearDamping = segmentPropertiesCylinder.linearDamping;
|
||||||
|
body.mass = segmentPropertiesCylinder.massPerUnitLength * segmentPropertiesCylinder.length;
|
||||||
|
body.solverIterations = segmentPropertiesCylinder.solverCount;
|
||||||
|
body.isKinematic = r.kinematic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/Scripts/PhysicsTools/Segment.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/Segment.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b876b665f2164469858aa78787017d4d
|
||||||
|
timeCreated: 1771646563
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
39
Assets/Scripts/PhysicsTools/SegmentProperties.cs
Normal file
39
Assets/Scripts/PhysicsTools/SegmentProperties.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SegmentProperties
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
CYLINDER = 0,
|
||||||
|
BOX = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type type;
|
||||||
|
|
||||||
|
public SegmentPropertiesBase properties;
|
||||||
|
|
||||||
|
public SegmentProperties()
|
||||||
|
{
|
||||||
|
properties = new SegmentPropertiesCylinder();
|
||||||
|
type = Type.CYLINDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Type t)
|
||||||
|
{
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case Type.BOX:
|
||||||
|
properties = new SegmentPropertiesBox();
|
||||||
|
break;
|
||||||
|
case Type.CYLINDER:
|
||||||
|
properties = new SegmentPropertiesCylinder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/SegmentProperties.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/SegmentProperties.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4cc846e1c08f18140bdf8f716aff9d45
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
27
Assets/Scripts/PhysicsTools/SegmentPropertiesBase.cs
Normal file
27
Assets/Scripts/PhysicsTools/SegmentPropertiesBase.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SegmentPropertiesBase
|
||||||
|
{
|
||||||
|
public float massPerUnitLength;
|
||||||
|
|
||||||
|
public int solverCount;
|
||||||
|
|
||||||
|
public float length;
|
||||||
|
|
||||||
|
public float linearDamping;
|
||||||
|
|
||||||
|
public float angularDamping;
|
||||||
|
|
||||||
|
public SegmentPropertiesBase()
|
||||||
|
{
|
||||||
|
massPerUnitLength = 10f;
|
||||||
|
solverCount = 255;
|
||||||
|
length = 1f;
|
||||||
|
linearDamping = 0.01f;
|
||||||
|
angularDamping = 0.01f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/SegmentPropertiesBase.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/SegmentPropertiesBase.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: adbcbbf68b6c67b4a919921e96801c2b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
19
Assets/Scripts/PhysicsTools/SegmentPropertiesBox.cs
Normal file
19
Assets/Scripts/PhysicsTools/SegmentPropertiesBox.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SegmentPropertiesBox : SegmentPropertiesBase
|
||||||
|
{
|
||||||
|
public float width;
|
||||||
|
|
||||||
|
public float height;
|
||||||
|
|
||||||
|
public SegmentPropertiesBox()
|
||||||
|
{
|
||||||
|
length = 1f;
|
||||||
|
width = 0.05f;
|
||||||
|
height = 0.2f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/PhysicsTools/SegmentPropertiesBox.cs.meta
Normal file
11
Assets/Scripts/PhysicsTools/SegmentPropertiesBox.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 278f3471b842200469e66a88287e903f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
16
Assets/Scripts/PhysicsTools/SegmentPropertiesCylinder.cs
Normal file
16
Assets/Scripts/PhysicsTools/SegmentPropertiesCylinder.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SegmentPropertiesCylinder : SegmentPropertiesBase
|
||||||
|
{
|
||||||
|
public float radius;
|
||||||
|
|
||||||
|
public SegmentPropertiesCylinder()
|
||||||
|
{
|
||||||
|
length = 1f;
|
||||||
|
radius = 0.1f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1876d7df821e9ca46a62254142001c6c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SerializedSoftJointLimitSpring
|
||||||
|
{
|
||||||
|
public float spring = 30000f;
|
||||||
|
|
||||||
|
public float damper = 30000f;
|
||||||
|
|
||||||
|
public SerializedSoftJointLimitSpring()
|
||||||
|
{
|
||||||
|
spring = 30000f;
|
||||||
|
damper = 30000f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SerializedSoftJointLimitSpring(SoftJointLimitSpring c)
|
||||||
|
{
|
||||||
|
damper = c.damper;
|
||||||
|
spring = c.spring;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator SoftJointLimitSpring(SerializedSoftJointLimitSpring c)
|
||||||
|
{
|
||||||
|
return new SoftJointLimitSpring
|
||||||
|
{
|
||||||
|
spring = c.spring,
|
||||||
|
damper = c.damper
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static explicit operator SerializedSoftJointLimitSpring(SoftJointLimitSpring c)
|
||||||
|
{
|
||||||
|
return new SerializedSoftJointLimitSpring(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e9f687b18e562c31f90c28822c0f641d
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
272
Assets/Scripts/PhysicsTools/Utility.cs
Normal file
272
Assets/Scripts/PhysicsTools/Utility.cs
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
public class Utility
|
||||||
|
{
|
||||||
|
public class Calc
|
||||||
|
{
|
||||||
|
private float r_length;
|
||||||
|
|
||||||
|
private float h;
|
||||||
|
|
||||||
|
private float d;
|
||||||
|
|
||||||
|
public Calc(float r_, float h_, float d_)
|
||||||
|
{
|
||||||
|
r_length = r_;
|
||||||
|
h = h_;
|
||||||
|
d = d_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float g(float s)
|
||||||
|
{
|
||||||
|
return (float)(2.0 * Math.Sinh(s * d / 2f) / (double)s - Math.Sqrt(r_length * r_length - h * h));
|
||||||
|
}
|
||||||
|
|
||||||
|
public float dg(float s)
|
||||||
|
{
|
||||||
|
return (float)(2.0 * Math.Cosh(s * d / 2f) * (double)d / (double)(2f * s) - 2.0 * Math.Sinh(s * d / 2f) / (double)(s * s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private const float DEG_2_RAD = 0.017453277f;
|
||||||
|
|
||||||
|
private const float RAD_2_DEG = 57.29583f;
|
||||||
|
|
||||||
|
public static void MatrixToTRS(Matrix4x4 mat, out Vector3 pos, out Quaternion rot, out Vector3 scale)
|
||||||
|
{
|
||||||
|
pos = mat.GetColumn(3);
|
||||||
|
rot = Quaternion.LookRotation(mat.GetColumn(2), mat.GetColumn(1));
|
||||||
|
scale = new Vector3(mat.GetColumn(0).magnitude, mat.GetColumn(1).magnitude, mat.GetColumn(2).magnitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Swap<T>(ref T lhs, ref T rhs)
|
||||||
|
{
|
||||||
|
T val = lhs;
|
||||||
|
lhs = rhs;
|
||||||
|
rhs = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Vector3> getCatenaryPts(Vector3 vStart, Vector3 vEnd, float r_length, int N)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
int num = 100;
|
||||||
|
float num2 = 1E-10f;
|
||||||
|
float num3 = 1E-08f;
|
||||||
|
float num4 = 0.5f;
|
||||||
|
float num5 = 1E-09f;
|
||||||
|
float num6 = 0.001f;
|
||||||
|
if (vStart.y > vEnd.y)
|
||||||
|
{
|
||||||
|
Swap(ref vStart, ref vEnd);
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
Vector3 vector = vEnd - vStart;
|
||||||
|
float y = vector.y;
|
||||||
|
vector.y = 0f;
|
||||||
|
Vector3 vector2 = vector / (N - 1);
|
||||||
|
float magnitude = vector.magnitude;
|
||||||
|
vector.Normalize();
|
||||||
|
float num7 = ((magnitude == 0f) ? 1f : (1f / magnitude));
|
||||||
|
List<Vector3> list = new List<Vector3>(new Vector3[N]);
|
||||||
|
if (Math.Abs(magnitude) < num6)
|
||||||
|
{
|
||||||
|
Vector3 vector3 = new Vector3((vStart.x + vEnd.x) / 2f, 0f, (vStart.z + vEnd.z) / 2f);
|
||||||
|
if (r_length < Math.Abs(y))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
list[i] = vector3 + new Vector3(0f, vStart.y + y * ((float)i * 1f / (float)(N - 1)), 0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num7 = (r_length - Math.Abs(y)) / 2f;
|
||||||
|
int num8 = (int)Math.Ceiling((float)N * num7 / r_length);
|
||||||
|
float num9 = Math.Max(vStart.y, vEnd.y);
|
||||||
|
float num10 = Math.Min(vStart.y, vEnd.y);
|
||||||
|
for (int j = 0; j < N; j++)
|
||||||
|
{
|
||||||
|
if (j < N - num8)
|
||||||
|
{
|
||||||
|
float num11 = num10 - num7 - num9;
|
||||||
|
float num12 = num11 * ((float)j * 1f / ((float)(N - num8) - 1f));
|
||||||
|
list[j] = vector3 + new Vector3(0f, num9 + num12, 0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float num13 = num7;
|
||||||
|
float num14 = num13 * ((float)j * 1f / ((float)num8 - 1f));
|
||||||
|
vector3 = (list[j] = vector3 + new Vector3(0f, num10 - num7 + num14, 0f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((double)r_length <= Math.Sqrt(magnitude * magnitude + y * y))
|
||||||
|
{
|
||||||
|
for (int k = 0; k < N; k++)
|
||||||
|
{
|
||||||
|
Vector3 value = vStart + k * vector2;
|
||||||
|
float num15 = (float)k * (vEnd.y - vStart.y) / (float)(N - 1);
|
||||||
|
value.y = vStart.y + num15;
|
||||||
|
list[k] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Calc calc = new Calc(r_length, y, magnitude);
|
||||||
|
for (int l = 0; l < num; l++)
|
||||||
|
{
|
||||||
|
float value2 = calc.g(num7);
|
||||||
|
float value3 = calc.dg(num7);
|
||||||
|
if (Math.Abs(value2) < num3 || Math.Abs(value3) < num2)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float num16 = (0f - calc.g(num7)) / calc.dg(num7);
|
||||||
|
float num17 = 1f;
|
||||||
|
float num18 = num7 + num17 * num16;
|
||||||
|
while (num18 < 0f || Math.Abs(calc.g(num18)) > Math.Abs(value2))
|
||||||
|
{
|
||||||
|
num17 = num4 * num17;
|
||||||
|
if (num17 < num5)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num18 = num7 + num17 * num16;
|
||||||
|
}
|
||||||
|
num7 = num18;
|
||||||
|
}
|
||||||
|
float num19 = (float)(0.5 * (Math.Log((r_length + y) / (r_length - y)) / (double)num7 - (double)magnitude));
|
||||||
|
vector.y = 0f;
|
||||||
|
vector.Normalize();
|
||||||
|
Vector3 vector5 = vStart - num19 * vector;
|
||||||
|
vector5.y = 0f;
|
||||||
|
float num20 = (float)((double)vStart.y - Math.Cosh(num19 * num7) / (double)num7);
|
||||||
|
for (int m = 0; m < N; m++)
|
||||||
|
{
|
||||||
|
Vector3 vector6 = vStart + m * vector2;
|
||||||
|
Vector3 vector7 = vector6;
|
||||||
|
vector6.y = 0f;
|
||||||
|
vector6.y = (float)(Math.Cosh((vector6 - vector5).magnitude * num7) / (double)num7 + (double)num20);
|
||||||
|
list[m] = vector6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
list.Reverse();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Quaternion createOrientation(Vector3 v)
|
||||||
|
{
|
||||||
|
if (v.x == 0f && v.y == 0f && v.z == 0f)
|
||||||
|
{
|
||||||
|
return Quaternion.identity;
|
||||||
|
}
|
||||||
|
Vector3 vector = new Vector3(0f, 1f, 0f);
|
||||||
|
Vector3 vector2 = Vector3.Cross(v, vector);
|
||||||
|
vector2.Normalize();
|
||||||
|
float num = Vector3.Dot(vector, v);
|
||||||
|
if (num > 1f)
|
||||||
|
{
|
||||||
|
num = 1f;
|
||||||
|
}
|
||||||
|
else if (num < -1f)
|
||||||
|
{
|
||||||
|
num = -1f;
|
||||||
|
}
|
||||||
|
float num2 = (float)Math.Acos(num);
|
||||||
|
return Quaternion.AngleAxis(num2 * 180f / 3.14159f, -vector2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T DeepClone<T>(T a)
|
||||||
|
{
|
||||||
|
using (MemoryStream memoryStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
BinaryFormatter binaryFormatter = new BinaryFormatter();
|
||||||
|
binaryFormatter.Serialize(memoryStream, a);
|
||||||
|
memoryStream.Position = 0L;
|
||||||
|
return (T)binaryFormatter.Deserialize(memoryStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<Rigidbody, List<UnityEngine.Joint>> buildMapOfJoints()
|
||||||
|
{
|
||||||
|
Dictionary<Rigidbody, List<UnityEngine.Joint>> dictionary = new Dictionary<Rigidbody, List<UnityEngine.Joint>>();
|
||||||
|
UnityEngine.Joint[] array = UnityEngine.Object.FindObjectsOfType<UnityEngine.Joint>();
|
||||||
|
UnityEngine.Joint[] array2 = array;
|
||||||
|
foreach (UnityEngine.Joint joint in array2)
|
||||||
|
{
|
||||||
|
Rigidbody component = joint.gameObject.GetComponent<Rigidbody>();
|
||||||
|
if (component != null)
|
||||||
|
{
|
||||||
|
if (!dictionary.ContainsKey(component))
|
||||||
|
{
|
||||||
|
dictionary.Add(component, new List<UnityEngine.Joint>());
|
||||||
|
}
|
||||||
|
dictionary[component].Add(joint);
|
||||||
|
}
|
||||||
|
Rigidbody connectedBody = joint.connectedBody;
|
||||||
|
if (connectedBody != null)
|
||||||
|
{
|
||||||
|
if (!dictionary.ContainsKey(connectedBody))
|
||||||
|
{
|
||||||
|
dictionary.Add(connectedBody, new List<UnityEngine.Joint>());
|
||||||
|
}
|
||||||
|
dictionary[connectedBody].Add(joint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void getConnectedBodies(ref Dictionary<Rigidbody, List<UnityEngine.Joint>> dic, Rigidbody body, ref HashSet<Rigidbody> bodies)
|
||||||
|
{
|
||||||
|
bodies.Add(body);
|
||||||
|
if (!dic.ContainsKey(body))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<UnityEngine.Joint> list = dic[body];
|
||||||
|
foreach (UnityEngine.Joint item in list)
|
||||||
|
{
|
||||||
|
if (item.connectedBody != null && !bodies.Contains(item.connectedBody))
|
||||||
|
{
|
||||||
|
getConnectedBodies(ref dic, item.connectedBody, ref bodies);
|
||||||
|
}
|
||||||
|
Rigidbody component = item.gameObject.GetComponent<Rigidbody>();
|
||||||
|
if (component != null && !bodies.Contains(component))
|
||||||
|
{
|
||||||
|
getConnectedBodies(ref dic, component, ref bodies);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void moveConnectedBodies(Rigidbody start, Matrix4x4 newPose)
|
||||||
|
{
|
||||||
|
Dictionary<Rigidbody, List<UnityEngine.Joint>> dic = buildMapOfJoints();
|
||||||
|
HashSet<Rigidbody> bodies = new HashSet<Rigidbody>();
|
||||||
|
getConnectedBodies(ref dic, start, ref bodies);
|
||||||
|
Matrix4x4 matrix4x = Matrix4x4.TRS(start.transform.position, start.transform.rotation, new Vector3(1f, 1f, 1f));
|
||||||
|
foreach (Rigidbody item in bodies)
|
||||||
|
{
|
||||||
|
Matrix4x4 matrix4x2 = Matrix4x4.TRS(item.transform.position, item.transform.rotation, new Vector3(1f, 1f, 1f));
|
||||||
|
Matrix4x4 inverse = matrix4x.inverse;
|
||||||
|
matrix4x2 = inverse * matrix4x2;
|
||||||
|
matrix4x2 = newPose * matrix4x2;
|
||||||
|
Vector3 pos;
|
||||||
|
Quaternion rot;
|
||||||
|
Vector3 scale;
|
||||||
|
MatrixToTRS(matrix4x2, out pos, out rot, out scale);
|
||||||
|
item.transform.position = pos;
|
||||||
|
item.transform.rotation = rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/Scripts/PhysicsTools/Utility.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/Utility.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 93c19397aa18981aebed2e7aba8ca270
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
103
Assets/Scripts/PhysicsTools/Winch.cs
Normal file
103
Assets/Scripts/PhysicsTools/Winch.cs
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PhysicsTools
|
||||||
|
{
|
||||||
|
public class Winch : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float brakeForce;
|
||||||
|
|
||||||
|
public float heaveTorque;
|
||||||
|
|
||||||
|
public float tensionTorque;
|
||||||
|
|
||||||
|
public float radius;
|
||||||
|
|
||||||
|
public float length;
|
||||||
|
|
||||||
|
public float inertia;
|
||||||
|
|
||||||
|
public float maxRopeLength;
|
||||||
|
|
||||||
|
public float minRopeLength;
|
||||||
|
|
||||||
|
public float rpm;
|
||||||
|
|
||||||
|
public float maxRPM;
|
||||||
|
|
||||||
|
private float omega;
|
||||||
|
|
||||||
|
public Rope rope;
|
||||||
|
|
||||||
|
public Winch()
|
||||||
|
{
|
||||||
|
radius = 1f;
|
||||||
|
length = 1f;
|
||||||
|
maxRPM = 1f;
|
||||||
|
omega = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
float fixedDeltaTime = Time.fixedDeltaTime;
|
||||||
|
float num = tensionTorqueValue() - heaveTorque;
|
||||||
|
float num2 = num / inertia;
|
||||||
|
float num3 = brakeForce * radius / inertia;
|
||||||
|
float num4 = omega + num2 * fixedDeltaTime;
|
||||||
|
if ((num2 < 0f && rope.getLength() > minRopeLength) || (num2 > 0f && num2 > num3 && rope.getLength() < maxRopeLength))
|
||||||
|
{
|
||||||
|
if (num4 > 0f && num4 - num3 * fixedDeltaTime < 0f)
|
||||||
|
{
|
||||||
|
num4 = 0f;
|
||||||
|
}
|
||||||
|
else if (num4 < 0f && num4 + num3 * fixedDeltaTime > 0f)
|
||||||
|
{
|
||||||
|
num4 = 0f;
|
||||||
|
}
|
||||||
|
else if (num4 > 0f)
|
||||||
|
{
|
||||||
|
num4 -= num3 * fixedDeltaTime;
|
||||||
|
}
|
||||||
|
else if (num4 < 0f)
|
||||||
|
{
|
||||||
|
num4 += num3 * fixedDeltaTime;
|
||||||
|
}
|
||||||
|
omega = num4;
|
||||||
|
rope.changeLength(getLinearSpeed() * fixedDeltaTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
omega = 0f;
|
||||||
|
}
|
||||||
|
rpm = omega / 6.28318f * 60f;
|
||||||
|
if (Math.Abs(rpm) > maxRPM)
|
||||||
|
{
|
||||||
|
if (rpm < 0f)
|
||||||
|
{
|
||||||
|
rpm = 0f - maxRPM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rpm = maxRPM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
omega = rpm / 60f * 6.28318f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float tensionTorqueValue()
|
||||||
|
{
|
||||||
|
tensionTorque = radius * getTension();
|
||||||
|
return tensionTorque;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getLinearSpeed()
|
||||||
|
{
|
||||||
|
return omega * radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getTension()
|
||||||
|
{
|
||||||
|
return rope.getTension();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/Scripts/PhysicsTools/Winch.cs.meta
Normal file
14
Assets/Scripts/PhysicsTools/Winch.cs.meta
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fac89f9401be21c56be128e602bbd1cd
|
||||||
|
timeCreated: 1771646562
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
name:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -24,7 +24,8 @@ Material:
|
|||||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||||
m_Parent: {fileID: 0}
|
m_Parent: {fileID: 0}
|
||||||
m_ModifiedSerializedProperties: 0
|
m_ModifiedSerializedProperties: 0
|
||||||
m_ValidKeywords: []
|
m_ValidKeywords:
|
||||||
|
- _EMISSION
|
||||||
m_InvalidKeywords: []
|
m_InvalidKeywords: []
|
||||||
m_LightmapFlags: 6
|
m_LightmapFlags: 6
|
||||||
m_EnableInstancingVariants: 0
|
m_EnableInstancingVariants: 0
|
||||||
@@ -156,8 +157,11 @@ Material:
|
|||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
m_Ints: []
|
m_Ints: []
|
||||||
m_Floats:
|
m_Floats:
|
||||||
|
- _AddPrecomputedVelocity: 0
|
||||||
- _AlphaClip: 0
|
- _AlphaClip: 0
|
||||||
|
- _AlphaToMask: 0
|
||||||
- _Blend: 0
|
- _Blend: 0
|
||||||
|
- _BlendModePreserveSpecular: 1
|
||||||
- _BumpScale: 1
|
- _BumpScale: 1
|
||||||
- _ClearCoatMask: 0
|
- _ClearCoatMask: 0
|
||||||
- _ClearCoatSmoothness: 0
|
- _ClearCoatSmoothness: 0
|
||||||
@@ -167,6 +171,7 @@ Material:
|
|||||||
- _DetailAlbedoMapScale: 1
|
- _DetailAlbedoMapScale: 1
|
||||||
- _DetailNormalMapScale: 1
|
- _DetailNormalMapScale: 1
|
||||||
- _DstBlend: 0
|
- _DstBlend: 0
|
||||||
|
- _DstBlendAlpha: 0
|
||||||
- _EnvironmentReflections: 1
|
- _EnvironmentReflections: 1
|
||||||
- _FoamAmount: 0.5
|
- _FoamAmount: 0.5
|
||||||
- _FogHeight: 1
|
- _FogHeight: 1
|
||||||
@@ -192,6 +197,7 @@ Material:
|
|||||||
- _SmoothnessTextureChannel: 0
|
- _SmoothnessTextureChannel: 0
|
||||||
- _SpecularHighlights: 1
|
- _SpecularHighlights: 1
|
||||||
- _SrcBlend: 1
|
- _SrcBlend: 1
|
||||||
|
- _SrcBlendAlpha: 1
|
||||||
- _Surface: 0
|
- _Surface: 0
|
||||||
- _Tesselation: 1
|
- _Tesselation: 1
|
||||||
- _Tiling: 2
|
- _Tiling: 2
|
||||||
@@ -201,6 +207,7 @@ Material:
|
|||||||
- _VSpeed: -0.1
|
- _VSpeed: -0.1
|
||||||
- _WaveHeightFoam: 0
|
- _WaveHeightFoam: 0
|
||||||
- _WorkflowMode: 1
|
- _WorkflowMode: 1
|
||||||
|
- _XRMotionVectorsPass: 1
|
||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _BaseColor: {r: 0.22745094, g: 0.27843133, b: 0.15686268, a: 1}
|
- _BaseColor: {r: 0.22745094, g: 0.27843133, b: 0.15686268, a: 1}
|
||||||
|
|||||||
@@ -9,31 +9,31 @@ EditorUserSettings:
|
|||||||
value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b07a68ffab74f9ee2a3a30300cea1a11320d0beb1a0c25f7060f494b4cc80018eb09361fc211cb1f862d19c51d19dcc413d6ade0d8ddfcddf9f4d9d29195fcfde6ebeae6f0a9c9afa6f8c5b89ff7a1aacececac4eba4d7c9d28bda
|
value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b07a68ffab74f9ee2a3a30300cea1a11320d0beb1a0c25f7060f494b4cc80018eb09361fc211cb1f862d19c51d19dcc413d6ade0d8ddfcddf9f4d9d29195fcfde6ebeae6f0a9c9afa6f8c5b89ff7a1aacececac4eba4d7c9d28bda
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-0:
|
RecentlyUsedSceneGuid-0:
|
||||||
value: 005305510002080a0b0c5d7a40725b4444151c2e7f2a73347c2f1c31b7e43069
|
value: 5b08515306560a0a0b0b542449770715474e4d7d7b7f7769792b1863e6b7313d
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-1:
|
RecentlyUsedSceneGuid-1:
|
||||||
value: 0700575554055059090c597611270a44154f19782e7a7e63757c4f6be7b66068
|
value: 5705040755540d0b5c5f547b417707134216487d7b707e6529714c6be6e33169
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-2:
|
RecentlyUsedSceneGuid-2:
|
||||||
value: 0157070300060d0c5c595a2346710d44174f497e2a2d223478714d32b2b86561
|
value: 00080756500d0d0355580a7049770a44454e19732f7b7f3575794566b2b6376a
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-3:
|
RecentlyUsedSceneGuid-3:
|
||||||
value: 55020355010d5b095c5b582016755944131619782d7a7e36742c4f32e7b66c39
|
value: 5702075052030b0e5458087142770745104f4a7d747d72667e2d4d36b2b8676f
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-4:
|
RecentlyUsedSceneGuid-4:
|
||||||
value: 500702045154585f5a0f5b7346740f44464e1c7f797f7531757d4b32b1e4373d
|
value: 5a520c0256040b0b0f5d5a7643775914474e412e2f70243678704c6ae0e16c6d
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-5:
|
RecentlyUsedSceneGuid-5:
|
||||||
value: 0504565e03535f0f540f5d2047760844454e4b7b7b2e72612f7e4f60b7b7373b
|
value: 0503575f5c57085954560d2447775e4513151e7c292c2035787f4b60b4e23760
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-6:
|
RecentlyUsedSceneGuid-6:
|
||||||
value: 54035007010d080c5f5a5c7115260b44104f4c2e797a2331752b4b66e1e13161
|
value: 02550255060d590c0c0b097016770b12444f1e2b7e2a2534797f4b60b6e46c60
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-7:
|
RecentlyUsedSceneGuid-7:
|
||||||
value: 0553065f5c5359025c5a5b2444205a44174e4c722d2d74667f7d1e61b2b2613a
|
value: 5309035757065a0a54575f7216265c4444151d28792e72627d2f1935bbb8673a
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-8:
|
RecentlyUsedSceneGuid-8:
|
||||||
value: 5309035757065a0a54575f7216265c4444151d28792e72627d2f1935bbb8673a
|
value: 07060c5454040c0a545b547240700a441216417e7f2e7268752c4966b4b0663d
|
||||||
flags: 0
|
flags: 0
|
||||||
RecentlyUsedSceneGuid-9:
|
RecentlyUsedSceneGuid-9:
|
||||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||||
|
|||||||
Reference in New Issue
Block a user