├── .gitignore ├── .gitmodules ├── Assets ├── Packages.meta ├── Packages │ └── UnityTools.meta ├── Scenes.meta ├── Scenes │ ├── FishActivationAdjustment.unity │ ├── FishActivationAdjustment.unity.meta │ ├── FishControllerOptimizer.unity │ ├── FishControllerOptimizer.unity.meta │ ├── FishPreview.unity │ ├── FishPreview.unity.meta │ ├── SampleScene.unity │ ├── SampleScene.unity.meta │ ├── TestScene.unity │ └── TestScene.unity.meta ├── Scripts.meta ├── Scripts │ ├── Barin.meta │ ├── Barin │ │ ├── BehaviorRoutine.cs │ │ ├── BehaviorRoutine.cs.meta │ │ ├── IntensionGenerator.cs │ │ ├── IntensionGenerator.cs.meta │ │ ├── MotorController.cs │ │ ├── MotorController.cs.meta │ │ ├── Perception.cs │ │ ├── Perception.cs.meta │ │ ├── TemperatureSensor.cs │ │ ├── TemperatureSensor.cs.meta │ │ ├── VisionSensor.cs │ │ └── VisionSensor.cs.meta │ ├── Common.meta │ ├── Common │ │ ├── FishBody.cs │ │ ├── FishBody.cs.meta │ │ ├── FishBrain.cs │ │ ├── FishBrain.cs.meta │ │ ├── FishController.cs │ │ └── FishController.cs.meta │ ├── External.meta │ ├── External │ │ ├── DSPLib.cs │ │ └── DSPLib.cs.meta │ ├── FFTTest.cs │ ├── FFTTest.cs.meta │ ├── FIshActivationData.cs │ ├── FIshActivationData.cs.meta │ ├── FishActivationAdjustment.cs │ ├── FishActivationAdjustment.cs.meta │ ├── FishData.cs │ ├── FishData.cs.meta │ ├── FishFood.cs │ ├── FishFood.cs.meta │ ├── FishLauncher.cs │ ├── FishLauncher.cs.meta │ ├── FishMC.cs │ ├── FishMC.cs.meta │ ├── FishManager.cs │ ├── FishManager.cs.meta │ ├── FishModelPreview.cs │ ├── FishModelPreview.cs.meta │ ├── FishMotorController.cs │ ├── FishMotorController.cs.meta │ ├── FishSimulator.cs │ ├── FishSimulator.cs.meta │ ├── FishSimulatorRunner.cs │ ├── FishSimulatorRunner.cs.meta │ ├── FishSolver.cs │ ├── FishSolver.cs.meta │ ├── FishTurn.cs │ ├── FishTurn.cs.meta │ ├── Obstacle.cs │ ├── Obstacle.cs.meta │ ├── Optimizer.meta │ ├── Optimizer │ │ ├── FIshSimulatorOffline.cs │ │ ├── FIshSimulatorOffline.cs.meta │ │ ├── FishControlOptimizer.cs │ │ ├── FishControlOptimizer.cs.meta │ │ ├── FishOfflineRunner.cs │ │ └── FishOfflineRunner.cs.meta │ ├── TestScript.meta │ └── TestScript │ │ ├── FinTest.cs │ │ ├── FinTest.cs.meta │ │ ├── LeftRight.cs │ │ └── LeftRight.cs.meta ├── StreamingAssets.meta └── StreamingAssets │ ├── HandAdjust.meta │ ├── HandAdjust │ ├── Swimming.ad │ ├── Swimming.ad.meta │ ├── TurnRight.ad │ └── TurnRight.ad.meta │ ├── SAProblem.data │ ├── SAProblem.data.meta │ ├── Swimming - コピー.ad │ ├── Swimming - コピー.ad.meta │ ├── Swimming.ad │ ├── Swimming.ad.meta │ ├── Turn.ad │ ├── Turn.ad.meta │ ├── TurnLeft.ad │ ├── TurnLeft.ad.meta │ ├── TurnRight.ad │ ├── TurnRight.ad.meta │ ├── archive.meta │ ├── archive │ ├── At.csv │ ├── At.csv.meta │ ├── D.csv │ ├── D.csv.meta │ ├── DSSwimming.func │ ├── DSSwimming.func.meta │ ├── L.csv │ ├── L.csv.meta │ ├── LT.csv │ ├── LT.csv.meta │ ├── Q.csv │ ├── Q.csv.meta │ ├── Q_1.csv │ ├── Q_1.csv.meta │ ├── SAProblem.data │ ├── SAProblem.data.meta │ ├── SAProblemEndSpeed.data │ ├── SAProblemEndSpeed.data.meta │ ├── SAProblemNoSim.data │ ├── SAProblemNoSim.data.meta │ ├── SAProblemTurn.data │ ├── SAProblemTurn.data.meta │ ├── Swimming - コピー (2).ad │ ├── Swimming - コピー (2).ad.meta │ ├── Swimming - コピー.ad │ ├── Swimming - コピー.ad.meta │ ├── Swimming.func │ ├── Swimming.func.meta │ ├── Swimming.mc │ ├── Swimming.mc.meta │ ├── Swimming2.ad │ ├── Swimming2.ad.meta │ ├── Swimmingb1.ad │ ├── Swimmingb1.ad.meta │ ├── Swimmingb2.ad │ ├── Swimmingb2.ad.meta │ ├── X_Velocity.csv │ ├── X_Velocity.csv.meta │ ├── fish - コピー.model │ ├── fish - コピー.model.meta │ ├── fish.graph │ ├── fish.graph.meta │ ├── s15.func │ ├── s15.func.meta │ ├── s30 - コピー.func │ ├── s30 - コピー.func.meta │ ├── s30.func │ ├── s30.func.meta │ ├── s301.func │ └── s301.func.meta │ ├── backup.meta │ ├── backup │ ├── Swimming.ad │ ├── Swimming.ad.meta │ ├── Swimmingorg.ad │ ├── Swimmingorg.ad.meta │ ├── TurnRightb1.ad │ └── TurnRightb1.ad.meta │ ├── fish.model │ ├── fish.model.meta │ ├── jellyfish.model │ └── jellyfish.model.meta ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset ├── README.md └── gif ├── food.gif ├── overview.gif └── swim.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Never ignore Asset meta data 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # TextMesh Pro files 20 | [Aa]ssets/TextMesh*Pro/ 21 | 22 | # Autogenerated Jetbrains Rider plugin 23 | [Aa]ssets/Plugins/Editor/JetBrains* 24 | 25 | # Visual Studio cache directory 26 | .vs/ 27 | 28 | # Gradle cache directory 29 | .gradle/ 30 | 31 | # Autogenerated VS/MD/Consulo solution and project files 32 | ExportedObj/ 33 | .consulo/ 34 | *.csproj 35 | *.unityproj 36 | *.sln 37 | *.suo 38 | *.tmp 39 | *.user 40 | *.userprefs 41 | *.pidb 42 | *.booproj 43 | *.svd 44 | *.pdb 45 | *.mdb 46 | *.opendb 47 | *.VC.db 48 | 49 | # Unity3D generated meta files 50 | *.pidb.meta 51 | *.pdb.meta 52 | *.mdb.meta 53 | 54 | # Unity3D generated file on crash reports 55 | sysinfo.txt 56 | 57 | # Builds 58 | *.apk 59 | *.unitypackage 60 | 61 | # Crashlytics generated file 62 | crashlytics-build.properties 63 | .vscode/ 64 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Assets/Packages/UnityTools"] 2 | path = Assets/Packages/UnityTools 3 | url = git@github.com:vanish87/UnityTools.git 4 | -------------------------------------------------------------------------------- /Assets/Packages.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b2b231ee19627243b4a41c5a96b394b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/UnityTools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00449f93b033b8041b4e83704d2e3617 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6b9093f541f3b044ae52373cba4927f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/FishActivationAdjustment.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &19204863 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 19204864} 133 | - component: {fileID: 19204865} 134 | - component: {fileID: 19204866} 135 | m_Layer: 0 136 | m_Name: Adjustment 137 | m_TagString: Untagged 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!4 &19204864 143 | Transform: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 19204863} 149 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 150 | m_LocalPosition: {x: 0, y: 0, z: 0} 151 | m_LocalScale: {x: 1, y: 1, z: 1} 152 | m_Children: [] 153 | m_Father: {fileID: 0} 154 | m_RootOrder: 2 155 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 156 | --- !u!114 &19204865 157 | MonoBehaviour: 158 | m_ObjectHideFlags: 0 159 | m_CorrespondingSourceObject: {fileID: 0} 160 | m_PrefabInstance: {fileID: 0} 161 | m_PrefabAsset: {fileID: 0} 162 | m_GameObject: {fileID: 19204863} 163 | m_Enabled: 1 164 | m_EditorHideFlags: 0 165 | m_Script: {fileID: 11500000, guid: 0a254a6b8f826a8448af32ffeeea1a8f, type: 3} 166 | m_Name: 167 | m_EditorClassIdentifier: 168 | type: 0 169 | fft: 1 170 | loop: 1 171 | curves: [] 172 | tunings: [] 173 | smc: 174 | parameters: 175 | - amplitude: 1 176 | frequency: 1 177 | - amplitude: 1 178 | frequency: 1 179 | speed: 1 180 | lmc: 181 | parameters: 182 | - amplitude: 1 183 | frequency: 1 184 | - amplitude: 1 185 | frequency: 1 186 | angle: 0 187 | rmc: 188 | parameters: 189 | - amplitude: 1 190 | frequency: 1 191 | - amplitude: 1 192 | frequency: 1 193 | angle: 0 194 | --- !u!114 &19204866 195 | MonoBehaviour: 196 | m_ObjectHideFlags: 0 197 | m_CorrespondingSourceObject: {fileID: 0} 198 | m_PrefabInstance: {fileID: 0} 199 | m_PrefabAsset: {fileID: 0} 200 | m_GameObject: {fileID: 19204863} 201 | m_Enabled: 1 202 | m_EditorHideFlags: 0 203 | m_Script: {fileID: 11500000, guid: 2561bd0319c38144cbc60697f824b9fa, type: 3} 204 | m_Name: 205 | m_EditorClassIdentifier: 206 | modelData: 207 | damping: 0.05 208 | normalFace: [] 209 | pectoralFins: [] 210 | --- !u!1 &677680560 211 | GameObject: 212 | m_ObjectHideFlags: 0 213 | m_CorrespondingSourceObject: {fileID: 0} 214 | m_PrefabInstance: {fileID: 0} 215 | m_PrefabAsset: {fileID: 0} 216 | serializedVersion: 6 217 | m_Component: 218 | - component: {fileID: 677680563} 219 | - component: {fileID: 677680562} 220 | - component: {fileID: 677680561} 221 | m_Layer: 0 222 | m_Name: Main Camera 223 | m_TagString: MainCamera 224 | m_Icon: {fileID: 0} 225 | m_NavMeshLayer: 0 226 | m_StaticEditorFlags: 0 227 | m_IsActive: 1 228 | --- !u!81 &677680561 229 | AudioListener: 230 | m_ObjectHideFlags: 0 231 | m_CorrespondingSourceObject: {fileID: 0} 232 | m_PrefabInstance: {fileID: 0} 233 | m_PrefabAsset: {fileID: 0} 234 | m_GameObject: {fileID: 677680560} 235 | m_Enabled: 1 236 | --- !u!20 &677680562 237 | Camera: 238 | m_ObjectHideFlags: 0 239 | m_CorrespondingSourceObject: {fileID: 0} 240 | m_PrefabInstance: {fileID: 0} 241 | m_PrefabAsset: {fileID: 0} 242 | m_GameObject: {fileID: 677680560} 243 | m_Enabled: 1 244 | serializedVersion: 2 245 | m_ClearFlags: 1 246 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 247 | m_projectionMatrixMode: 1 248 | m_GateFitMode: 2 249 | m_FOVAxisMode: 0 250 | m_SensorSize: {x: 36, y: 24} 251 | m_LensShift: {x: 0, y: 0} 252 | m_FocalLength: 50 253 | m_NormalizedViewPortRect: 254 | serializedVersion: 2 255 | x: 0 256 | y: 0 257 | width: 1 258 | height: 1 259 | near clip plane: 0.3 260 | far clip plane: 1000 261 | field of view: 60 262 | orthographic: 0 263 | orthographic size: 5 264 | m_Depth: -1 265 | m_CullingMask: 266 | serializedVersion: 2 267 | m_Bits: 4294967295 268 | m_RenderingPath: -1 269 | m_TargetTexture: {fileID: 0} 270 | m_TargetDisplay: 0 271 | m_TargetEye: 3 272 | m_HDR: 1 273 | m_AllowMSAA: 1 274 | m_AllowDynamicResolution: 0 275 | m_ForceIntoRT: 0 276 | m_OcclusionCulling: 1 277 | m_StereoConvergence: 10 278 | m_StereoSeparation: 0.022 279 | --- !u!4 &677680563 280 | Transform: 281 | m_ObjectHideFlags: 0 282 | m_CorrespondingSourceObject: {fileID: 0} 283 | m_PrefabInstance: {fileID: 0} 284 | m_PrefabAsset: {fileID: 0} 285 | m_GameObject: {fileID: 677680560} 286 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 287 | m_LocalPosition: {x: 0, y: 1, z: -10} 288 | m_LocalScale: {x: 1, y: 1, z: 1} 289 | m_Children: [] 290 | m_Father: {fileID: 0} 291 | m_RootOrder: 0 292 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 293 | --- !u!1 &1633586300 294 | GameObject: 295 | m_ObjectHideFlags: 0 296 | m_CorrespondingSourceObject: {fileID: 0} 297 | m_PrefabInstance: {fileID: 0} 298 | m_PrefabAsset: {fileID: 0} 299 | serializedVersion: 6 300 | m_Component: 301 | - component: {fileID: 1633586302} 302 | - component: {fileID: 1633586301} 303 | m_Layer: 0 304 | m_Name: Directional Light 305 | m_TagString: Untagged 306 | m_Icon: {fileID: 0} 307 | m_NavMeshLayer: 0 308 | m_StaticEditorFlags: 0 309 | m_IsActive: 1 310 | --- !u!108 &1633586301 311 | Light: 312 | m_ObjectHideFlags: 0 313 | m_CorrespondingSourceObject: {fileID: 0} 314 | m_PrefabInstance: {fileID: 0} 315 | m_PrefabAsset: {fileID: 0} 316 | m_GameObject: {fileID: 1633586300} 317 | m_Enabled: 1 318 | serializedVersion: 10 319 | m_Type: 1 320 | m_Shape: 0 321 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 322 | m_Intensity: 1 323 | m_Range: 10 324 | m_SpotAngle: 30 325 | m_InnerSpotAngle: 21.80208 326 | m_CookieSize: 10 327 | m_Shadows: 328 | m_Type: 2 329 | m_Resolution: -1 330 | m_CustomResolution: -1 331 | m_Strength: 1 332 | m_Bias: 0.05 333 | m_NormalBias: 0.4 334 | m_NearPlane: 0.2 335 | m_CullingMatrixOverride: 336 | e00: 1 337 | e01: 0 338 | e02: 0 339 | e03: 0 340 | e10: 0 341 | e11: 1 342 | e12: 0 343 | e13: 0 344 | e20: 0 345 | e21: 0 346 | e22: 1 347 | e23: 0 348 | e30: 0 349 | e31: 0 350 | e32: 0 351 | e33: 1 352 | m_UseCullingMatrixOverride: 0 353 | m_Cookie: {fileID: 0} 354 | m_DrawHalo: 0 355 | m_Flare: {fileID: 0} 356 | m_RenderMode: 0 357 | m_CullingMask: 358 | serializedVersion: 2 359 | m_Bits: 4294967295 360 | m_RenderingLayerMask: 1 361 | m_Lightmapping: 4 362 | m_LightShadowCasterMode: 0 363 | m_AreaSize: {x: 1, y: 1} 364 | m_BounceIntensity: 1 365 | m_ColorTemperature: 6570 366 | m_UseColorTemperature: 0 367 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 368 | m_UseBoundingSphereOverride: 0 369 | m_ShadowRadius: 0 370 | m_ShadowAngle: 0 371 | --- !u!4 &1633586302 372 | Transform: 373 | m_ObjectHideFlags: 0 374 | m_CorrespondingSourceObject: {fileID: 0} 375 | m_PrefabInstance: {fileID: 0} 376 | m_PrefabAsset: {fileID: 0} 377 | m_GameObject: {fileID: 1633586300} 378 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 379 | m_LocalPosition: {x: 0, y: 3, z: 0} 380 | m_LocalScale: {x: 1, y: 1, z: 1} 381 | m_Children: [] 382 | m_Father: {fileID: 0} 383 | m_RootOrder: 1 384 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 385 | -------------------------------------------------------------------------------- /Assets/Scenes/FishActivationAdjustment.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e55d162c440ee2043a58f3cf75ac2104 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/FishControllerOptimizer.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &72128516 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 72128519} 133 | - component: {fileID: 72128518} 134 | - component: {fileID: 72128517} 135 | m_Layer: 0 136 | m_Name: Main Camera 137 | m_TagString: MainCamera 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!81 &72128517 143 | AudioListener: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 72128516} 149 | m_Enabled: 1 150 | --- !u!20 &72128518 151 | Camera: 152 | m_ObjectHideFlags: 0 153 | m_CorrespondingSourceObject: {fileID: 0} 154 | m_PrefabInstance: {fileID: 0} 155 | m_PrefabAsset: {fileID: 0} 156 | m_GameObject: {fileID: 72128516} 157 | m_Enabled: 1 158 | serializedVersion: 2 159 | m_ClearFlags: 1 160 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 161 | m_projectionMatrixMode: 1 162 | m_GateFitMode: 2 163 | m_FOVAxisMode: 0 164 | m_SensorSize: {x: 36, y: 24} 165 | m_LensShift: {x: 0, y: 0} 166 | m_FocalLength: 50 167 | m_NormalizedViewPortRect: 168 | serializedVersion: 2 169 | x: 0 170 | y: 0 171 | width: 1 172 | height: 1 173 | near clip plane: 0.3 174 | far clip plane: 1000 175 | field of view: 60 176 | orthographic: 0 177 | orthographic size: 5 178 | m_Depth: -1 179 | m_CullingMask: 180 | serializedVersion: 2 181 | m_Bits: 4294967295 182 | m_RenderingPath: -1 183 | m_TargetTexture: {fileID: 0} 184 | m_TargetDisplay: 0 185 | m_TargetEye: 3 186 | m_HDR: 1 187 | m_AllowMSAA: 1 188 | m_AllowDynamicResolution: 0 189 | m_ForceIntoRT: 0 190 | m_OcclusionCulling: 1 191 | m_StereoConvergence: 10 192 | m_StereoSeparation: 0.022 193 | --- !u!4 &72128519 194 | Transform: 195 | m_ObjectHideFlags: 0 196 | m_CorrespondingSourceObject: {fileID: 0} 197 | m_PrefabInstance: {fileID: 0} 198 | m_PrefabAsset: {fileID: 0} 199 | m_GameObject: {fileID: 72128516} 200 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 201 | m_LocalPosition: {x: 0, y: 1, z: -10} 202 | m_LocalScale: {x: 1, y: 1, z: 1} 203 | m_Children: [] 204 | m_Father: {fileID: 0} 205 | m_RootOrder: 0 206 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 207 | --- !u!1 &396207379 208 | GameObject: 209 | m_ObjectHideFlags: 0 210 | m_CorrespondingSourceObject: {fileID: 0} 211 | m_PrefabInstance: {fileID: 0} 212 | m_PrefabAsset: {fileID: 0} 213 | serializedVersion: 6 214 | m_Component: 215 | - component: {fileID: 396207381} 216 | - component: {fileID: 396207380} 217 | m_Layer: 0 218 | m_Name: Directional Light 219 | m_TagString: Untagged 220 | m_Icon: {fileID: 0} 221 | m_NavMeshLayer: 0 222 | m_StaticEditorFlags: 0 223 | m_IsActive: 1 224 | --- !u!108 &396207380 225 | Light: 226 | m_ObjectHideFlags: 0 227 | m_CorrespondingSourceObject: {fileID: 0} 228 | m_PrefabInstance: {fileID: 0} 229 | m_PrefabAsset: {fileID: 0} 230 | m_GameObject: {fileID: 396207379} 231 | m_Enabled: 1 232 | serializedVersion: 10 233 | m_Type: 1 234 | m_Shape: 0 235 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 236 | m_Intensity: 1 237 | m_Range: 10 238 | m_SpotAngle: 30 239 | m_InnerSpotAngle: 21.80208 240 | m_CookieSize: 10 241 | m_Shadows: 242 | m_Type: 2 243 | m_Resolution: -1 244 | m_CustomResolution: -1 245 | m_Strength: 1 246 | m_Bias: 0.05 247 | m_NormalBias: 0.4 248 | m_NearPlane: 0.2 249 | m_CullingMatrixOverride: 250 | e00: 1 251 | e01: 0 252 | e02: 0 253 | e03: 0 254 | e10: 0 255 | e11: 1 256 | e12: 0 257 | e13: 0 258 | e20: 0 259 | e21: 0 260 | e22: 1 261 | e23: 0 262 | e30: 0 263 | e31: 0 264 | e32: 0 265 | e33: 1 266 | m_UseCullingMatrixOverride: 0 267 | m_Cookie: {fileID: 0} 268 | m_DrawHalo: 0 269 | m_Flare: {fileID: 0} 270 | m_RenderMode: 0 271 | m_CullingMask: 272 | serializedVersion: 2 273 | m_Bits: 4294967295 274 | m_RenderingLayerMask: 1 275 | m_Lightmapping: 4 276 | m_LightShadowCasterMode: 0 277 | m_AreaSize: {x: 1, y: 1} 278 | m_BounceIntensity: 1 279 | m_ColorTemperature: 6570 280 | m_UseColorTemperature: 0 281 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 282 | m_UseBoundingSphereOverride: 0 283 | m_ShadowRadius: 0 284 | m_ShadowAngle: 0 285 | --- !u!4 &396207381 286 | Transform: 287 | m_ObjectHideFlags: 0 288 | m_CorrespondingSourceObject: {fileID: 0} 289 | m_PrefabInstance: {fileID: 0} 290 | m_PrefabAsset: {fileID: 0} 291 | m_GameObject: {fileID: 396207379} 292 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 293 | m_LocalPosition: {x: 0, y: 3, z: 0} 294 | m_LocalScale: {x: 1, y: 1, z: 1} 295 | m_Children: [] 296 | m_Father: {fileID: 0} 297 | m_RootOrder: 1 298 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 299 | --- !u!1 &1754125477 300 | GameObject: 301 | m_ObjectHideFlags: 0 302 | m_CorrespondingSourceObject: {fileID: 0} 303 | m_PrefabInstance: {fileID: 0} 304 | m_PrefabAsset: {fileID: 0} 305 | serializedVersion: 6 306 | m_Component: 307 | - component: {fileID: 1754125479} 308 | - component: {fileID: 1754125478} 309 | m_Layer: 0 310 | m_Name: GUI 311 | m_TagString: Untagged 312 | m_Icon: {fileID: 0} 313 | m_NavMeshLayer: 0 314 | m_StaticEditorFlags: 0 315 | m_IsActive: 1 316 | --- !u!114 &1754125478 317 | MonoBehaviour: 318 | m_ObjectHideFlags: 0 319 | m_CorrespondingSourceObject: {fileID: 0} 320 | m_PrefabInstance: {fileID: 0} 321 | m_PrefabAsset: {fileID: 0} 322 | m_GameObject: {fileID: 1754125477} 323 | m_Enabled: 1 324 | m_EditorHideFlags: 0 325 | m_Script: {fileID: 11500000, guid: b443a6a3d6a750f448e29de36b8e3554, type: 3} 326 | m_Name: 327 | m_EditorClassIdentifier: 328 | windowData: [] 329 | --- !u!4 &1754125479 330 | Transform: 331 | m_ObjectHideFlags: 0 332 | m_CorrespondingSourceObject: {fileID: 0} 333 | m_PrefabInstance: {fileID: 0} 334 | m_PrefabAsset: {fileID: 0} 335 | m_GameObject: {fileID: 1754125477} 336 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 337 | m_LocalPosition: {x: 0, y: 0, z: 0} 338 | m_LocalScale: {x: 1, y: 1, z: 1} 339 | m_Children: [] 340 | m_Father: {fileID: 0} 341 | m_RootOrder: 4 342 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 343 | --- !u!1 &1915739896 344 | GameObject: 345 | m_ObjectHideFlags: 0 346 | m_CorrespondingSourceObject: {fileID: 0} 347 | m_PrefabInstance: {fileID: 0} 348 | m_PrefabAsset: {fileID: 0} 349 | serializedVersion: 6 350 | m_Component: 351 | - component: {fileID: 1915739898} 352 | - component: {fileID: 1915739897} 353 | m_Layer: 0 354 | m_Name: Optimizer 355 | m_TagString: Untagged 356 | m_Icon: {fileID: 0} 357 | m_NavMeshLayer: 0 358 | m_StaticEditorFlags: 0 359 | m_IsActive: 1 360 | --- !u!114 &1915739897 361 | MonoBehaviour: 362 | m_ObjectHideFlags: 0 363 | m_CorrespondingSourceObject: {fileID: 0} 364 | m_PrefabInstance: {fileID: 0} 365 | m_PrefabAsset: {fileID: 0} 366 | m_GameObject: {fileID: 1915739896} 367 | m_Enabled: 1 368 | m_EditorHideFlags: 0 369 | m_Script: {fileID: 11500000, guid: c779a7125f04c514a974d4d9fec3f306, type: 3} 370 | m_Name: 371 | m_EditorClassIdentifier: 372 | timeInterval: 373 | x: 0 374 | y: 3.1415 375 | sampleNum: 15 376 | fileName: SAProblem.data 377 | curves: [] 378 | sa: 379 | maxCount: 0 380 | minCount: 0 381 | --- !u!4 &1915739898 382 | Transform: 383 | m_ObjectHideFlags: 0 384 | m_CorrespondingSourceObject: {fileID: 0} 385 | m_PrefabInstance: {fileID: 0} 386 | m_PrefabAsset: {fileID: 0} 387 | m_GameObject: {fileID: 1915739896} 388 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 389 | m_LocalPosition: {x: 0, y: 0, z: 0} 390 | m_LocalScale: {x: 1, y: 1, z: 1} 391 | m_Children: [] 392 | m_Father: {fileID: 0} 393 | m_RootOrder: 2 394 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 395 | --- !u!1 &1970876666 396 | GameObject: 397 | m_ObjectHideFlags: 0 398 | m_CorrespondingSourceObject: {fileID: 0} 399 | m_PrefabInstance: {fileID: 0} 400 | m_PrefabAsset: {fileID: 0} 401 | serializedVersion: 6 402 | m_Component: 403 | - component: {fileID: 1970876668} 404 | - component: {fileID: 1970876667} 405 | - component: {fileID: 1970876669} 406 | m_Layer: 0 407 | m_Name: Preview 408 | m_TagString: Untagged 409 | m_Icon: {fileID: 0} 410 | m_NavMeshLayer: 0 411 | m_StaticEditorFlags: 0 412 | m_IsActive: 0 413 | --- !u!114 &1970876667 414 | MonoBehaviour: 415 | m_ObjectHideFlags: 0 416 | m_CorrespondingSourceObject: {fileID: 0} 417 | m_PrefabInstance: {fileID: 0} 418 | m_PrefabAsset: {fileID: 0} 419 | m_GameObject: {fileID: 1970876666} 420 | m_Enabled: 1 421 | m_EditorHideFlags: 0 422 | m_Script: {fileID: 11500000, guid: ce647a8f8d7c1404287bd0df81c88342, type: 3} 423 | m_Name: 424 | m_EditorClassIdentifier: 425 | interval: 426 | x: 0 427 | y: 5 428 | sampleNum: 15 429 | curves: [] 430 | activations: [] 431 | --- !u!4 &1970876668 432 | Transform: 433 | m_ObjectHideFlags: 0 434 | m_CorrespondingSourceObject: {fileID: 0} 435 | m_PrefabInstance: {fileID: 0} 436 | m_PrefabAsset: {fileID: 0} 437 | m_GameObject: {fileID: 1970876666} 438 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 439 | m_LocalPosition: {x: 0, y: 0, z: 0} 440 | m_LocalScale: {x: 1, y: 1, z: 1} 441 | m_Children: [] 442 | m_Father: {fileID: 0} 443 | m_RootOrder: 3 444 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 445 | --- !u!114 &1970876669 446 | MonoBehaviour: 447 | m_ObjectHideFlags: 0 448 | m_CorrespondingSourceObject: {fileID: 0} 449 | m_PrefabInstance: {fileID: 0} 450 | m_PrefabAsset: {fileID: 0} 451 | m_GameObject: {fileID: 1970876666} 452 | m_Enabled: 1 453 | m_EditorHideFlags: 0 454 | m_Script: {fileID: 11500000, guid: 2561bd0319c38144cbc60697f824b9fa, type: 3} 455 | m_Name: 456 | m_EditorClassIdentifier: 457 | modelData: 458 | damping: 0.05 459 | normalFace: [] 460 | pectoralFins: [] 461 | -------------------------------------------------------------------------------- /Assets/Scenes/FishControllerOptimizer.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d739a1a525d36cc44984da218e81ee68 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/FishPreview.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &785274048 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 785274050} 133 | - component: {fileID: 785274049} 134 | - component: {fileID: 785274051} 135 | m_Layer: 0 136 | m_Name: Preview 137 | m_TagString: Untagged 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!114 &785274049 143 | MonoBehaviour: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 785274048} 149 | m_Enabled: 1 150 | m_EditorHideFlags: 0 151 | m_Script: {fileID: 11500000, guid: 2d2256d7c43041443a14b36043d67268, type: 3} 152 | m_Name: 153 | m_EditorClassIdentifier: 154 | activationFileName: Swimming.ad 155 | mode: 0 156 | stepMode: 1 157 | activation: 0 158 | timeInterval: 159 | x: 0 160 | y: 10 161 | sampleNum: 15 162 | fft: 0 163 | loop: 1 164 | curves: [] 165 | runtimeList: [] 166 | useJellyFish: 0 167 | --- !u!4 &785274050 168 | Transform: 169 | m_ObjectHideFlags: 0 170 | m_CorrespondingSourceObject: {fileID: 0} 171 | m_PrefabInstance: {fileID: 0} 172 | m_PrefabAsset: {fileID: 0} 173 | m_GameObject: {fileID: 785274048} 174 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 175 | m_LocalPosition: {x: 0, y: 0, z: 0} 176 | m_LocalScale: {x: 1, y: 1, z: 1} 177 | m_Children: [] 178 | m_Father: {fileID: 0} 179 | m_RootOrder: 2 180 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 181 | --- !u!114 &785274051 182 | MonoBehaviour: 183 | m_ObjectHideFlags: 0 184 | m_CorrespondingSourceObject: {fileID: 0} 185 | m_PrefabInstance: {fileID: 0} 186 | m_PrefabAsset: {fileID: 0} 187 | m_GameObject: {fileID: 785274048} 188 | m_Enabled: 1 189 | m_EditorHideFlags: 0 190 | m_Script: {fileID: 11500000, guid: 2561bd0319c38144cbc60697f824b9fa, type: 3} 191 | m_Name: 192 | m_EditorClassIdentifier: 193 | modelFileName: fish.model 194 | modelData: 195 | damping: 0.05 196 | normalFace: [] 197 | pectoralFins: [] 198 | --- !u!1 &1371400465 199 | GameObject: 200 | m_ObjectHideFlags: 0 201 | m_CorrespondingSourceObject: {fileID: 0} 202 | m_PrefabInstance: {fileID: 0} 203 | m_PrefabAsset: {fileID: 0} 204 | serializedVersion: 6 205 | m_Component: 206 | - component: {fileID: 1371400467} 207 | - component: {fileID: 1371400466} 208 | m_Layer: 0 209 | m_Name: Directional Light 210 | m_TagString: Untagged 211 | m_Icon: {fileID: 0} 212 | m_NavMeshLayer: 0 213 | m_StaticEditorFlags: 0 214 | m_IsActive: 1 215 | --- !u!108 &1371400466 216 | Light: 217 | m_ObjectHideFlags: 0 218 | m_CorrespondingSourceObject: {fileID: 0} 219 | m_PrefabInstance: {fileID: 0} 220 | m_PrefabAsset: {fileID: 0} 221 | m_GameObject: {fileID: 1371400465} 222 | m_Enabled: 1 223 | serializedVersion: 10 224 | m_Type: 1 225 | m_Shape: 0 226 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 227 | m_Intensity: 1 228 | m_Range: 10 229 | m_SpotAngle: 30 230 | m_InnerSpotAngle: 21.80208 231 | m_CookieSize: 10 232 | m_Shadows: 233 | m_Type: 2 234 | m_Resolution: -1 235 | m_CustomResolution: -1 236 | m_Strength: 1 237 | m_Bias: 0.05 238 | m_NormalBias: 0.4 239 | m_NearPlane: 0.2 240 | m_CullingMatrixOverride: 241 | e00: 1 242 | e01: 0 243 | e02: 0 244 | e03: 0 245 | e10: 0 246 | e11: 1 247 | e12: 0 248 | e13: 0 249 | e20: 0 250 | e21: 0 251 | e22: 1 252 | e23: 0 253 | e30: 0 254 | e31: 0 255 | e32: 0 256 | e33: 1 257 | m_UseCullingMatrixOverride: 0 258 | m_Cookie: {fileID: 0} 259 | m_DrawHalo: 0 260 | m_Flare: {fileID: 0} 261 | m_RenderMode: 0 262 | m_CullingMask: 263 | serializedVersion: 2 264 | m_Bits: 4294967295 265 | m_RenderingLayerMask: 1 266 | m_Lightmapping: 4 267 | m_LightShadowCasterMode: 0 268 | m_AreaSize: {x: 1, y: 1} 269 | m_BounceIntensity: 1 270 | m_ColorTemperature: 6570 271 | m_UseColorTemperature: 0 272 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 273 | m_UseBoundingSphereOverride: 0 274 | m_ShadowRadius: 0 275 | m_ShadowAngle: 0 276 | --- !u!4 &1371400467 277 | Transform: 278 | m_ObjectHideFlags: 0 279 | m_CorrespondingSourceObject: {fileID: 0} 280 | m_PrefabInstance: {fileID: 0} 281 | m_PrefabAsset: {fileID: 0} 282 | m_GameObject: {fileID: 1371400465} 283 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 284 | m_LocalPosition: {x: 0, y: 3, z: 0} 285 | m_LocalScale: {x: 1, y: 1, z: 1} 286 | m_Children: [] 287 | m_Father: {fileID: 0} 288 | m_RootOrder: 1 289 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 290 | --- !u!1 &1449375301 291 | GameObject: 292 | m_ObjectHideFlags: 0 293 | m_CorrespondingSourceObject: {fileID: 0} 294 | m_PrefabInstance: {fileID: 0} 295 | m_PrefabAsset: {fileID: 0} 296 | serializedVersion: 6 297 | m_Component: 298 | - component: {fileID: 1449375304} 299 | - component: {fileID: 1449375303} 300 | - component: {fileID: 1449375302} 301 | m_Layer: 0 302 | m_Name: Main Camera 303 | m_TagString: MainCamera 304 | m_Icon: {fileID: 0} 305 | m_NavMeshLayer: 0 306 | m_StaticEditorFlags: 0 307 | m_IsActive: 1 308 | --- !u!81 &1449375302 309 | AudioListener: 310 | m_ObjectHideFlags: 0 311 | m_CorrespondingSourceObject: {fileID: 0} 312 | m_PrefabInstance: {fileID: 0} 313 | m_PrefabAsset: {fileID: 0} 314 | m_GameObject: {fileID: 1449375301} 315 | m_Enabled: 1 316 | --- !u!20 &1449375303 317 | Camera: 318 | m_ObjectHideFlags: 0 319 | m_CorrespondingSourceObject: {fileID: 0} 320 | m_PrefabInstance: {fileID: 0} 321 | m_PrefabAsset: {fileID: 0} 322 | m_GameObject: {fileID: 1449375301} 323 | m_Enabled: 1 324 | serializedVersion: 2 325 | m_ClearFlags: 1 326 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 327 | m_projectionMatrixMode: 1 328 | m_GateFitMode: 2 329 | m_FOVAxisMode: 0 330 | m_SensorSize: {x: 36, y: 24} 331 | m_LensShift: {x: 0, y: 0} 332 | m_FocalLength: 50 333 | m_NormalizedViewPortRect: 334 | serializedVersion: 2 335 | x: 0 336 | y: 0 337 | width: 1 338 | height: 1 339 | near clip plane: 0.3 340 | far clip plane: 1000 341 | field of view: 60 342 | orthographic: 0 343 | orthographic size: 5 344 | m_Depth: -1 345 | m_CullingMask: 346 | serializedVersion: 2 347 | m_Bits: 4294967295 348 | m_RenderingPath: -1 349 | m_TargetTexture: {fileID: 0} 350 | m_TargetDisplay: 0 351 | m_TargetEye: 3 352 | m_HDR: 1 353 | m_AllowMSAA: 1 354 | m_AllowDynamicResolution: 0 355 | m_ForceIntoRT: 0 356 | m_OcclusionCulling: 1 357 | m_StereoConvergence: 10 358 | m_StereoSeparation: 0.022 359 | --- !u!4 &1449375304 360 | Transform: 361 | m_ObjectHideFlags: 0 362 | m_CorrespondingSourceObject: {fileID: 0} 363 | m_PrefabInstance: {fileID: 0} 364 | m_PrefabAsset: {fileID: 0} 365 | m_GameObject: {fileID: 1449375301} 366 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 367 | m_LocalPosition: {x: 0, y: 1, z: -10} 368 | m_LocalScale: {x: 1, y: 1, z: 1} 369 | m_Children: [] 370 | m_Father: {fileID: 0} 371 | m_RootOrder: 0 372 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 373 | -------------------------------------------------------------------------------- /Assets/Scenes/FishPreview.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c414bd9500ea2a740a8ab7711e732b15 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/TestScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe7b2b7b9db6bef488aeef772469241a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5db3df81b4cf69f43869b851557d908f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7759a5e29bf096d4784e72eeaa8c7298 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/BehaviorRoutine.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | using UnityTools.Debuging; 6 | using UnityTools.Math; 7 | 8 | namespace UnityFishSimulation 9 | { 10 | [System.Serializable] 11 | public class BehaviorRoutine 12 | { 13 | protected List motorControllers = new List(); 14 | 15 | protected SwimMC smc; 16 | protected TurnLeftMC tlmc; 17 | protected TurnRightMC trmc; 18 | 19 | [SerializeField] protected List curves; 20 | [SerializeField] protected TuningData tuning; 21 | public List ToMC() 22 | { 23 | return this.motorControllers; 24 | } 25 | public void Init(Intension intension, Perception perception, FishBody body) 26 | { 27 | this.motorControllers.Clear(); 28 | 29 | var focusser = perception.GetFocuser(); 30 | 31 | var normal = body.modelData.Normal; 32 | var left = body.modelData.Left; 33 | var dir = focusser.target.obj.obj.Position - body.modelData.GeometryCenter; 34 | 35 | var motorType = focusser.motorPreference.MaxValue.type; 36 | if (motorType == Focusser.MotorPreference.Type.MoveForward) 37 | { 38 | if(this.smc == null) 39 | { 40 | this.smc = new SwimMC(); 41 | this.curves = this.smc.ActivationData.ToAnimationCurves(); 42 | } 43 | if(focusser.target.obj != null) 44 | { 45 | this.smc.UpdateSpeed(focusser.target.obj.distance); 46 | } 47 | this.motorControllers.Add(this.smc); 48 | } 49 | else if (motorType == Focusser.MotorPreference.Type.TurnLeft) 50 | { 51 | if(this.tlmc == null) 52 | { 53 | this.tlmc = new TurnLeftMC(); 54 | this.curves = this.tlmc.ActivationData.ToAnimationCurves(); 55 | } 56 | var angle = this.GetAngleInFish(dir, normal, left); 57 | this.tlmc.UpdateAngle(angle); 58 | this.motorControllers.Add(this.tlmc); 59 | 60 | this.smc?.UpdateSpeed(0); 61 | } 62 | else if (motorType == Focusser.MotorPreference.Type.TurnRight) 63 | { 64 | if(this.trmc == null) 65 | { 66 | this.trmc = new TurnRightMC(); 67 | this.curves = this.trmc.ActivationData.ToAnimationCurves(); 68 | } 69 | var angle = this.GetAngleInFish(dir, normal, left); 70 | this.trmc.UpdateAngle(angle); 71 | this.motorControllers.Add(this.trmc); 72 | 73 | this.smc?.UpdateSpeed(0); 74 | } 75 | 76 | 77 | var balance = new BalanceMC(); 78 | balance.UpdateBalance(left, normal); 79 | this.motorControllers.Add(balance); 80 | } 81 | 82 | protected float GetAngleInFish(float3 targetDirection, float3 normal, float3 left) 83 | { 84 | var projection = Tool.ProjectionOnPlane(targetDirection, normal); 85 | var angle = Tool.CosAngle(projection, left); 86 | return angle; 87 | // var theta = math.PI/5; 88 | // var forward = math.PI/2; 89 | // //>0 left 90 | // //<0 right 91 | // var forwardAngle = new float2(math.cos(forward - theta), math.cos(forward + theta)); 92 | // if(forwardAngle.x > angle && angle > forwardAngle.y) return MotorPreference.Type.MoveForward; 93 | // return angle > 0? MotorPreference.Type.TurnLeft:MotorPreference.Type.TurnRight; 94 | } 95 | 96 | 97 | } 98 | } 99 | 100 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/BehaviorRoutine.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a0afae604c48ea4a934c01fa34f6c9c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/IntensionGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityTools.Common; 7 | using UnityTools.Debuging; 8 | 9 | namespace UnityFishSimulation 10 | { 11 | public abstract class Intension 12 | { 13 | public enum Type 14 | { 15 | Avoid, 16 | Escape, 17 | School, 18 | Eat, 19 | Mate, 20 | Leave, 21 | Wander 22 | } 23 | 24 | public abstract Type IntensionType { get; } 25 | } 26 | 27 | public class AvoidIntension : Intension 28 | { 29 | public override Type IntensionType => Type.Avoid; 30 | public AvoidIntension(GameObject closestObj) 31 | { 32 | 33 | } 34 | } 35 | public class EscapedIntension : Intension 36 | { 37 | public override Type IntensionType => Type.Escape; 38 | public EscapedIntension(GameObject closestObj) 39 | { 40 | 41 | } 42 | } 43 | public class SchoolIntension : Intension 44 | { 45 | public override Type IntensionType => Type.School; 46 | public SchoolIntension() 47 | { 48 | 49 | } 50 | } 51 | public class EatIntension : Intension 52 | { 53 | public override Type IntensionType => Type.Eat; 54 | public EatIntension() 55 | { 56 | 57 | } 58 | } 59 | public class MateIntension : Intension 60 | { 61 | public override Type IntensionType => Type.Mate; 62 | public MateIntension() 63 | { 64 | 65 | } 66 | } 67 | public class WanderIntension : Intension 68 | { 69 | public override Type IntensionType => Type.Wander; 70 | public WanderIntension() 71 | { 72 | 73 | } 74 | } 75 | 76 | [System.Serializable] 77 | public class IntensionGenerator 78 | { 79 | public float f0 = 0.5f;//[0.1,0.5] 80 | public float f1 = 0.8f;//f1 > f0 81 | public float r = 0.25f;//[0,0.5] 82 | 83 | protected LinkedList intensionStack = new LinkedList(); 84 | public Intension Generate(Perception perception, Habits habits, MentalState mental, PhysicalState ps, float t) 85 | { 86 | Intension intension = default; 87 | var sensorData = perception.GetSensorData(); 88 | var distance = sensorData.closestDangerObj == null ? -1 : sensorData.closestDangerObj.distance; 89 | if (distance > 0) 90 | { 91 | var mono = sensorData.closestDangerObj.obj as MonoBehaviour; 92 | intension = new AvoidIntension(mono.gameObject); 93 | 94 | if (this.intensionStack.Count == 0 || this.intensionStack.Last.Value.IntensionType != Intension.Type.Avoid) 95 | { 96 | this.intensionStack.AddLast(intension); 97 | } 98 | } 99 | else 100 | { 101 | //fear of most dangerous predator m 102 | var p = sensorData.GetClosestByType(ObjectType.Predator); 103 | var Fm = p != null ? ps.Fi(p.distance) : 0; 104 | var F = mental.fear; 105 | if (F > this.f0) 106 | { 107 | if (Fm < this.f1 && habits.schooling) 108 | { 109 | intension = new SchoolIntension(); 110 | } 111 | else 112 | { 113 | var mono = p.obj as MonoBehaviour; 114 | intension = new EscapedIntension(mono.gameObject); 115 | } 116 | } 117 | else 118 | { 119 | if (this.IsLastEatOrMate()) 120 | { 121 | intension = this.intensionStack.Last.Value; 122 | this.intensionStack.RemoveLast(); 123 | } 124 | else 125 | { 126 | intension = this.GenerateNewIntension(perception, habits, mental, ps, t); 127 | } 128 | } 129 | } 130 | 131 | if (this.intensionStack.Count > 1) this.intensionStack.RemoveFirst(); 132 | 133 | 134 | LogTool.AssertIsTrue(intension != null); 135 | 136 | return intension; 137 | } 138 | 139 | protected bool IsLastEatOrMate() 140 | { 141 | if (this.intensionStack.Count == 0) return false; 142 | 143 | var It1 = this.intensionStack.Last.Value; 144 | return (It1.IntensionType == Intension.Type.Eat || It1.IntensionType == Intension.Type.Mate); 145 | } 146 | 147 | protected Intension GenerateNewIntension(Perception perception, Habits habits, MentalState mental, PhysicalState ps, float t) 148 | { 149 | Intension intension = default; 150 | var H = mental.hunger; 151 | var L = mental.libido; 152 | 153 | if (this.r < math.max(H, L)) 154 | { 155 | if (H == L) 156 | { 157 | if (ThreadSafeRandom.NextFloat() > 0.5f) intension = new EatIntension(); 158 | else intension = new MateIntension(); 159 | } 160 | else 161 | { 162 | if (H > L) intension = new EatIntension(); 163 | else intension = new MateIntension(); 164 | } 165 | } 166 | else 167 | { 168 | //perception.temperatureSensor; 169 | //perception.visionSensor; 170 | 171 | //generate wonder or leave 172 | intension = new WanderIntension(); 173 | } 174 | 175 | return intension; 176 | } 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/IntensionGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ed570968a6a93e48a64dc0d5b5e4dc3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/MotorController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityTools.Common; 7 | using UnityTools.Math; 8 | 9 | namespace UnityFishSimulation 10 | { 11 | [System.Serializable] 12 | public class MotorController 13 | { 14 | 15 | } 16 | 17 | [System.Serializable] 18 | public abstract class MuscleMC : MotorController 19 | { 20 | [System.Serializable] 21 | public class Parameter 22 | { 23 | public readonly float2 aMinMax = new float2(0, 1); 24 | public readonly float2 fMinMax = new float2(0, 0.075f); 25 | public float amplitude = 1; 26 | public float frequency = 1; 27 | } 28 | protected FishActivationData activationData; 29 | protected Dictionary muscleControlParamters; 30 | [SerializeField] protected List parameters;//Debug data 31 | protected abstract List GetSpringTypes(); 32 | protected abstract string FileName { get; } 33 | 34 | public FishActivationData ActivationData => this.activationData; 35 | public abstract Parameter GetParameter(Spring.Type type); 36 | 37 | public MuscleMC() 38 | { 39 | this.muscleControlParamters = new Dictionary(); 40 | var types = this.GetSpringTypes(); 41 | foreach (var t in types) 42 | { 43 | this.muscleControlParamters.Add(t, new Parameter()); 44 | } 45 | 46 | this.activationData = FishActivationData.Load(this.FileName); 47 | 48 | this.parameters = this.muscleControlParamters.Values.ToList(); 49 | } 50 | } 51 | 52 | [System.Serializable] 53 | public class SwimMC : MuscleMC 54 | { 55 | [SerializeField, Range(0, 1)] protected float speed = 1; 56 | 57 | protected DiscreteFunction speedParameterMap; 58 | protected override string FileName => "Swimming"; 59 | protected override List GetSpringTypes() 60 | { 61 | return new List() { Spring.Type.MuscleMiddle, Spring.Type.MuscleBack }; 62 | } 63 | public override Parameter GetParameter(Spring.Type type) 64 | { 65 | if (this.muscleControlParamters.ContainsKey(type)) 66 | { 67 | var parameter = this.muscleControlParamters[type]; 68 | var mapped = this.speedParameterMap.Evaluate(this.speed); 69 | parameter.amplitude = math.lerp(parameter.amplitude, mapped.x, 0.3f); 70 | parameter.frequency = math.lerp(parameter.frequency, mapped.y, 0.3f); 71 | return parameter; 72 | } 73 | //convert from speed to parameter 74 | return new Parameter(); 75 | } 76 | 77 | public SwimMC() : base() 78 | { 79 | var parameterVec = new Vector(4); 80 | parameterVec[0] = new float2(0, 0); 81 | parameterVec[1] = new float2(0.6f, 1.2f); 82 | parameterVec[2] = new float2(1.0f, 1.5f); 83 | parameterVec[3] = new float2(1.2f, 2f); 84 | this.speedParameterMap = new DiscreteFunction(0, 1, parameterVec); 85 | } 86 | public void UpdateSpeed(float distance) 87 | { 88 | var maxDis = 20f; 89 | this.speed = math.saturate(distance / maxDis); 90 | } 91 | 92 | } 93 | 94 | [System.Serializable] 95 | public class TurnLeftMC : MuscleMC 96 | { 97 | [SerializeField, Range(0, math.PI / 2)] protected float angle = 0f; 98 | protected DiscreteFunction angleParameterMap; 99 | protected override string FileName => "TurnLeft"; 100 | protected override List GetSpringTypes() 101 | { 102 | return new List() { Spring.Type.MuscleFront, Spring.Type.MuscleMiddle }; 103 | } 104 | 105 | public override Parameter GetParameter(Spring.Type type) 106 | { 107 | if (this.muscleControlParamters.ContainsKey(type)) 108 | { 109 | var parameter = this.muscleControlParamters[type]; 110 | var mapped = this.angleParameterMap.Evaluate(this.angle); 111 | parameter.amplitude = math.lerp(parameter.amplitude, mapped.x, 0.3f); 112 | parameter.frequency = math.lerp(parameter.frequency, mapped.y, 0.3f); 113 | return parameter; 114 | } 115 | //convert from speed to parameter 116 | return new Parameter(); 117 | } 118 | public TurnLeftMC() : base() 119 | { 120 | var parameterVec = new Vector(4); 121 | parameterVec[0] = new float2(1.0f, 1.0f); 122 | parameterVec[1] = new float2(0.4f, 0.5f); 123 | parameterVec[2] = new float2(0.2f, 0.3f); 124 | parameterVec[3] = new float2(0, 0); 125 | this.angleParameterMap = new DiscreteFunction(0, math.PI / 2, parameterVec); 126 | } 127 | public void UpdateAngle(float angle) 128 | { 129 | this.angle = math.acos(angle); 130 | } 131 | } 132 | [System.Serializable] 133 | public class TurnRightMC : MuscleMC 134 | { 135 | [SerializeField, Range(math.PI / 2, math.PI)] protected float angle = math.PI; 136 | protected DiscreteFunction angleParameterMap; 137 | protected override string FileName => "TurnRight"; 138 | protected override List GetSpringTypes() 139 | { 140 | return new List() { Spring.Type.MuscleFront, Spring.Type.MuscleMiddle }; 141 | } 142 | 143 | public override Parameter GetParameter(Spring.Type type) 144 | { 145 | if (this.muscleControlParamters.ContainsKey(type)) 146 | { 147 | var parameter = this.muscleControlParamters[type]; 148 | var mapped = this.angleParameterMap.Evaluate(this.angle); 149 | parameter.amplitude = math.lerp(parameter.amplitude, mapped.x, 0.3f); 150 | parameter.frequency = math.lerp(parameter.frequency, mapped.y, 0.3f); 151 | return parameter; 152 | } 153 | //convert from speed to parameter 154 | return new Parameter(); 155 | } 156 | public TurnRightMC() : base() 157 | { 158 | var parameterVec = new Vector(4); 159 | parameterVec[0] = new float2(0, 0); 160 | parameterVec[1] = new float2(0.2f, 0.3f); 161 | parameterVec[2] = new float2(0.4f, 0.5f); 162 | parameterVec[3] = new float2(1.0f, 1.0f); 163 | this.angleParameterMap = new DiscreteFunction(math.PI / 2, math.PI, parameterVec); 164 | 165 | } 166 | public void UpdateAngle(float angle) 167 | { 168 | this.angle = math.acos(angle); 169 | } 170 | } 171 | 172 | public class GlideMC : MuscleMC 173 | { 174 | protected float time = 0; 175 | protected override string FileName => "Glide"; 176 | protected override List GetSpringTypes() 177 | { 178 | return new List() { Spring.Type.MuscleFront, Spring.Type.MuscleMiddle, Spring.Type.MuscleBack }; 179 | } 180 | 181 | public override Parameter GetParameter(Spring.Type type) 182 | { 183 | //convert from speed to parameter 184 | return default; 185 | } 186 | } 187 | 188 | [System.Serializable] 189 | public class BalanceMC : MotorController 190 | { 191 | public float lFin => this.leftFin; 192 | public float rFin => this.rightFin; 193 | protected float3 worldUp = new float3(0, 1, 0); 194 | [SerializeField] protected float leftFin; 195 | [SerializeField] protected float rightFin; 196 | 197 | public void UpdateBalance(float3 left, float3 normal) 198 | { 199 | var angleWithWorld = math.acos(Tool.CosAngle(left, this.worldUp)); 200 | 201 | // Debug.Log(angleWithWorld); 202 | 203 | var t = angleWithWorld / math.PI; 204 | 205 | var up = math.PI * 3 / 4; 206 | var down = math.PI / 4; 207 | 208 | this.leftFin = math.lerp(down, up, t); 209 | this.rightFin = math.lerp(up, down, t); 210 | } 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/MotorController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bba279e0d94c4747bd5e4a0ba03b076 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/Perception.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Unity.Mathematics; 6 | using UnityEngine; 7 | using UnityTools.Debuging.EditorTool; 8 | using UnityTools.Math; 9 | 10 | namespace UnityFishSimulation 11 | { 12 | public class SensorObject 13 | { 14 | public ISensorableObject obj; 15 | public float distance; 16 | } 17 | 18 | [System.Serializable] 19 | public class SensorData 20 | { 21 | 22 | [SerializeField] public float worldBrightness = 1; 23 | 24 | [SerializeField] protected Dictionary> currentSensorableObjects = new Dictionary>(); 25 | [SerializeField] protected Dictionary> currentVisiableObjects = new Dictionary>(); 26 | [SerializeField] protected Dictionary> currentDangerObjects = new Dictionary>(); 27 | 28 | [SerializeField] protected Dictionary closestObjects = new Dictionary(); 29 | [SerializeField] public SensorObject closestDangerObj = null; 30 | 31 | public SensorData() 32 | { 33 | foreach (ObjectType t in Enum.GetValues(typeof(ObjectType))) 34 | { 35 | this.currentSensorableObjects.Add(t, new List()); 36 | this.currentVisiableObjects.Add(t, new List()); 37 | this.currentDangerObjects.Add(t, new List()); 38 | } 39 | } 40 | public void SetClosest(ISensorableObject obj, float distance) 41 | { 42 | var type = obj.ObjType; 43 | var newObj = new SensorObject() { obj = obj, distance = distance }; 44 | if(this.closestObjects.ContainsKey(type)) 45 | { 46 | this.closestObjects[type] = newObj; 47 | } 48 | else 49 | { 50 | this.closestObjects.Add(type, newObj); 51 | } 52 | } 53 | public SensorObject GetClosestByType(ObjectType type) 54 | { 55 | return this.closestObjects.ContainsKey(type) ? this.closestObjects[type] : null; 56 | } 57 | 58 | public List GetSensorable(ObjectType type) { return this.currentSensorableObjects[type]; } 59 | public List GetVisiable(ObjectType type) { return this.currentVisiableObjects[type]; } 60 | public List GetDanger(ObjectType type) { return this.currentDangerObjects[type]; } 61 | public void AddSensorable(ISensorableObject obj, float distance) 62 | { 63 | var type = obj.ObjType; 64 | this.currentSensorableObjects[type].Add(new SensorObject(){obj = obj, distance = distance}); 65 | } 66 | public void AddVisiable(ISensorableObject obj, float distance) 67 | { 68 | var type = obj.ObjType; 69 | this.currentVisiableObjects[type].Add(new SensorObject(){obj = obj, distance = distance}); 70 | } 71 | public void AddDanger(ISensorableObject obj, float distance) 72 | { 73 | var type = obj.ObjType; 74 | this.currentDangerObjects[type].Add(new SensorObject(){obj = obj, distance = distance}); 75 | } 76 | public void Clear() 77 | { 78 | foreach(var l in this.currentSensorableObjects.Values) l.Clear(); 79 | foreach(var l in this.currentVisiableObjects.Values) l.Clear(); 80 | foreach(var l in this.currentDangerObjects.Values) l.Clear(); 81 | 82 | this.closestObjects.Clear(); 83 | this.closestDangerObj = null; 84 | } 85 | } 86 | public class Perception : MonoBehaviour 87 | { 88 | protected VisionSensor visionSensor; 89 | protected TemperatureSensor temperatureSensor; 90 | 91 | private SensorData sensorData = new SensorData(); 92 | 93 | [SerializeField] protected Focusser focusser = new Focusser(); 94 | 95 | public void Init() 96 | { 97 | this.visionSensor = this.GetComponent(); 98 | this.temperatureSensor = this.GetComponent(); 99 | } 100 | 101 | public void SensorUpdate(FishSimulator.Delta delta) 102 | { 103 | this.sensorData.Clear(); 104 | this.visionSensor.Scan(this.sensorData); 105 | } 106 | public void FocusserUpdate(Intension intension, Desire desire, FishBody body) 107 | { 108 | this.focusser.Update(intension, this, desire, body); 109 | } 110 | public Focusser GetFocuser(){return this.focusser;} 111 | 112 | public SensorData GetSensorData() { return this.sensorData; } 113 | 114 | 115 | protected void OnDrawGizmos() 116 | { 117 | this.focusser.OnDrawGizmos(); 118 | } 119 | } 120 | 121 | [System.Serializable] 122 | public class Focusser 123 | { 124 | 125 | [System.Serializable] 126 | public class Target 127 | { 128 | public SensorObject obj; 129 | } 130 | [System.Serializable] 131 | //Intension->MotorPreference->Focus 132 | public class MotorPreference 133 | { 134 | public enum Type 135 | { 136 | TurnLeft, 137 | TurnRight, 138 | MoveForward, 139 | MoveBackward, 140 | Ascend, 141 | Descend, 142 | } 143 | [Serializable] 144 | public class Data 145 | { 146 | public Type type; 147 | public float value; 148 | } 149 | [SerializeField] protected List motorPreferenceData = new List(); 150 | 151 | public Data MaxValue=>this.motorPreferenceData.OrderByDescending(m=>m.value).FirstOrDefault(); 152 | public Data this[Type t] 153 | { 154 | get => this.motorPreferenceData.Where(m=>m.type == t).FirstOrDefault(); 155 | } 156 | public MotorPreference() 157 | { 158 | foreach(Type t in Enum.GetValues(typeof(Type))) 159 | { 160 | this.motorPreferenceData.Add(new Data(){type = t, value = 0}); 161 | } 162 | } 163 | public void Clear() 164 | { 165 | foreach(var v in this.motorPreferenceData) 166 | { 167 | v.value = 0; 168 | } 169 | } 170 | } 171 | 172 | [SerializeField] public MotorPreference motorPreference = new MotorPreference(); 173 | public Target target = new Target(); 174 | //active focus and filter out none-important sensor data 175 | //save to Target 176 | public void Update(Intension intension, Perception perception, Desire desire, FishBody body) 177 | { 178 | //get desires 179 | //avoid, fear, eat, mate 180 | 181 | this.motorPreference.Clear(); 182 | var foods = perception.GetSensorData().GetVisiable(ObjectType.Food); 183 | foreach (var f in foods) 184 | { 185 | var mtype = this.GetMotorPreferenceType(f.obj, perception, body); 186 | this.motorPreference[mtype].value += desire.eat; 187 | } 188 | 189 | var obstacles = perception.GetSensorData().GetVisiable(ObjectType.Obstacle); 190 | foreach(var o in obstacles) 191 | { 192 | var mtype = this.GetMotorPreferenceType(o.obj, perception, body); 193 | this.motorPreference[mtype].value -= desire.avoid; 194 | } 195 | //TODO add predator value 196 | 197 | var targetType = intension.IntensionType == Intension.Type.Eat ? ObjectType.Food : ObjectType.Obstacle; 198 | 199 | var sameSide = foods.Where(o=>this.GetMotorPreferenceType(o.obj, perception, body) == this.motorPreference.MaxValue.type); 200 | this.target.obj = sameSide.OrderBy(o=>o.distance).FirstOrDefault(); 201 | //if intension == avoid 202 | 203 | //if intension == escape 204 | 205 | } 206 | 207 | //TODO return multiple motorpreference 208 | protected MotorPreference.Type GetMotorPreferenceType(ISensorableObject obj, Perception perception, FishBody body) 209 | { 210 | var org = body.modelData.GeometryCenter; 211 | var dir = body.modelData.Left; 212 | 213 | var angle = Tool.CosAngle(dir, obj.Position - org); 214 | //>0 left 215 | //<0 right 216 | var forwardAngle = new float2(math.cos(math.radians(90-25)), math.cos(math.radians(90+25))); 217 | if(forwardAngle.x > angle && angle > forwardAngle.y) return MotorPreference.Type.MoveForward; 218 | return angle > 0? MotorPreference.Type.TurnLeft:MotorPreference.Type.TurnRight; 219 | } 220 | 221 | public void OnDrawGizmos() 222 | { 223 | if(this.target.obj != null) 224 | { 225 | using(new GizmosScope(Color.red, Matrix4x4.identity)) 226 | { 227 | Gizmos.DrawSphere(target.obj.obj.Position, 2); 228 | } 229 | } 230 | } 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/Perception.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5ebcb0179bbdd24eac919b4e50845f6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/TemperatureSensor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace UnityFishSimulation 6 | { 7 | public class TemperatureSensor : MonoBehaviour 8 | { 9 | // Start is called before the first frame update 10 | void Start() 11 | { 12 | 13 | } 14 | 15 | // Update is called once per frame 16 | void Update() 17 | { 18 | 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/TemperatureSensor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d55d3990bc18cea4082b671add78cbd1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Barin/VisionSensor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Unity.Mathematics; 6 | using UnityEngine; 7 | using UnityTools.Algorithm; 8 | using UnityTools.Common; 9 | using UnityTools.Debuging; 10 | using UnityTools.Debuging.EditorTool; 11 | 12 | namespace UnityFishSimulation 13 | { 14 | public class VisionSensor : MonoBehaviour, ISensorableObject, FishManager.IManagerUser 15 | { 16 | [SerializeField] protected bool debug = false; 17 | [SerializeField] protected float size = 1;//vision size 18 | [SerializeField] protected int angle = 300; 19 | [SerializeField] protected float Vr = 1; // visual range 20 | [SerializeField] protected float Or = 2; //foraging range 21 | [SerializeField] protected float Dr = 0.1f; //danger range 22 | 23 | public float3 Position => this.transform.position; 24 | public float Size => this.size; 25 | 26 | public FishManager Manager { get; set; } 27 | 28 | public ObjectType ObjType => ObjectType.Predator; 29 | 30 | public float GetDistance(ISensorableObject other) 31 | { 32 | return math.distance(this.Position, other.Position) * other.Size; 33 | } 34 | 35 | public void Scan(SensorData sensorData) 36 | { 37 | var from = this as ISensorableObject; 38 | var o = new float3(this.Position); 39 | var dir = new float3(this.transform.forward); 40 | var minDis = new Dictionary(); 41 | foreach(ObjectType t in Enum.GetValues(typeof(ObjectType))) 42 | { 43 | minDis.Add(t, this.Or); 44 | } 45 | 46 | var minDangerDis = this.Dr; 47 | 48 | LogTool.AssertIsTrue(this.Manager != null); 49 | foreach (var f in this.Manager.SensorableObjects) 50 | { 51 | if (from == f) continue; 52 | var distance = from.GetDistance(f); 53 | if (distance < this.Or) 54 | { 55 | sensorData.AddSensorable(f, distance); 56 | 57 | var p = f.Position; 58 | var angle = math.dot(math.normalize(p - o), math.normalize(dir)); 59 | if (distance < this.Vr && angle > math.cos(math.radians(this.angle / 2))) 60 | { 61 | sensorData.AddVisiable(f, distance); 62 | 63 | if(distance < this.Dr) 64 | { 65 | sensorData.AddDanger(f, distance); 66 | 67 | if(distance < minDangerDis) 68 | { 69 | minDangerDis = distance; 70 | sensorData.closestDangerObj = new SensorObject(){obj=f, distance= distance}; 71 | } 72 | } 73 | } 74 | } 75 | if (distance < minDis[f.ObjType]) 76 | { 77 | minDis[f.ObjType] = distance; 78 | sensorData.SetClosest(f, distance); 79 | } 80 | } 81 | } 82 | 83 | protected void OnDrawGizmos() 84 | { 85 | if (this.debug) 86 | { 87 | using (new GizmosScope(Color.white, Matrix4x4.identity)) 88 | { 89 | Gizmos.DrawWireSphere(this.Position, this.Vr); 90 | Gizmos.DrawWireSphere(this.Position, this.Or); 91 | } 92 | } 93 | } 94 | 95 | } 96 | 97 | 98 | 99 | 100 | 101 | } -------------------------------------------------------------------------------- /Assets/Scripts/Barin/VisionSensor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ead45bde172b6b43abd8f8f9970c4b8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77ad51d305e06314f93e8118da932d63 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Common/FishBody.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | using UnityTools.Attributes; 6 | 7 | namespace UnityFishSimulation 8 | { 9 | public class FishBody : MonoBehaviour 10 | { 11 | [SerializeField, FileNamePopup("*.model")] protected string modelFileName = "fish"; 12 | public FishModelData modelData; 13 | 14 | public void Init() 15 | { 16 | this.modelData = GeometryFunctions.Load(this.modelFileName); 17 | } 18 | protected void Update() 19 | { 20 | var parent = this.transform.parent; 21 | if (parent != null) 22 | { 23 | var up = this.modelData.Normal; 24 | var forward = this.modelData.Direction; 25 | var left = UnityTools.Math.Tool.Normal(up, forward); 26 | // parent.transform.position = this.modelData.GeometryCenter; 27 | // parent.transform.up = up; 28 | // parent.transform.forward = left; 29 | // parent.transform.right = UnityTools.Math.Tool.Normal(left, up); 30 | } 31 | } 32 | protected void OnDrawGizmos() 33 | { 34 | this.modelData?.OnGizmos(GeometryFunctions.springColorMap); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Assets/Scripts/Common/FishBody.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2561bd0319c38144cbc60697f824b9fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Common/FishBrain.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | 7 | namespace UnityFishSimulation 8 | { 9 | public class FishBrain : MonoBehaviour 10 | { 11 | public Intension CurrentIntension => this.currentIntension; 12 | public Desire CurrentDesire => this.currentDesire; 13 | [SerializeField] protected Habits habits = new Habits(); 14 | [SerializeField] protected MentalState mentalState = new MentalState(); 15 | [SerializeField] protected PhysicalState physicalState = new PhysicalState(); 16 | 17 | [SerializeField] protected IntensionGenerator intensionGenerator = new IntensionGenerator(); 18 | 19 | [SerializeField] protected Intension currentIntension; 20 | [SerializeField] protected Desire currentDesire = new Desire(); 21 | 22 | public void Init() 23 | { 24 | 25 | } 26 | public void UpdateBrain(FishSimulator.Delta delta, Perception perception) 27 | { 28 | var t = delta.deltaTime; 29 | this.physicalState.UpdateTime(t); 30 | this.mentalState.UpdateState(t, this.physicalState, perception.GetSensorData()); 31 | 32 | this.currentIntension = this.intensionGenerator.Generate(perception, this.habits, this.mentalState, this.physicalState, t); 33 | this.currentDesire.UpdateDesire(this.mentalState, this.currentIntension); 34 | } 35 | } 36 | 37 | [System.Serializable] 38 | public class Habits 39 | { 40 | public enum LightPreference 41 | { 42 | Brightness, 43 | Neutral, 44 | Darkness, 45 | } 46 | public enum TempratruePreference 47 | { 48 | Cold, 49 | Neutral, 50 | Warmth, 51 | } 52 | 53 | public LightPreference light = LightPreference.Neutral; 54 | public TempratruePreference temperature = TempratruePreference.Neutral; 55 | public bool isMale = true; 56 | public bool schooling = true; 57 | } 58 | [System.Serializable] 59 | public class Desire 60 | { 61 | public float avoid = 0; 62 | public float fear = 0; 63 | public float eat = 0; 64 | public float mate = 0; 65 | public Intension.Type intensionType; 66 | 67 | public void UpdateDesire(MentalState mental, Intension intension) 68 | { 69 | this.intensionType = intension.IntensionType; 70 | 71 | var ti = 1f; 72 | switch(intension.IntensionType) 73 | { 74 | case Intension.Type.Escape: ti = mental.fear; break; 75 | case Intension.Type.Eat: ti = mental.hunger; break; 76 | case Intension.Type.Mate: ti = mental.libido; break; 77 | default: ti = 1; break; 78 | } 79 | this.avoid = 1; 80 | this.fear = mental.fear / ti; 81 | this.eat = mental.hunger / ti; 82 | this.mate = mental.libido / ti; 83 | } 84 | } 85 | [System.Serializable] 86 | public class MentalState 87 | { 88 | //new ones 89 | public float hunger = 1; 90 | public float libido = 1; 91 | public float fear = 1; 92 | 93 | protected float S(SensorObject target, float q1, float q2) 94 | { 95 | if(target == null) return 0; 96 | 97 | var s = 1 / target.distance; 98 | 99 | if (s < q1) 100 | { 101 | return 0; 102 | } 103 | else 104 | if (q1 <= s && s <= q2) 105 | { 106 | return (s - q1) / (2 * q2 - q1 - s); 107 | } 108 | else 109 | { 110 | return 1; 111 | } 112 | } 113 | 114 | public void UpdateState(float t, PhysicalState physical, SensorData sensor) 115 | { 116 | var closestFood = sensor.GetClosestByType(ObjectType.Food); 117 | var closestMate = sensor.GetClosestByType(ObjectType.Mate); 118 | this.H(t, physical, closestFood); 119 | this.L(t, physical, closestMate); 120 | this.F(t, physical, sensor.GetVisiable(ObjectType.Predator)); 121 | } 122 | 123 | private float Sh(SensorObject target) { return this.S(target, 0.05f, 0.2f); } 124 | private float Sl(SensorObject target) { return this.S(target, 0.025f, 0.1f); } 125 | 126 | private float H(float t, PhysicalState ps, SensorObject target) 127 | { 128 | var internalUrge = 1 - ps.foodEaten * ps.Rx(ps.timeSinceLastMeal) / ps.appetite; 129 | var externalStimuli = ps.alphah * this.Sh(target); 130 | 131 | 132 | var H = math.min(internalUrge + externalStimuli, 1); 133 | 134 | this.hunger = H; 135 | 136 | return this.hunger; 137 | } 138 | 139 | private float L(float t, PhysicalState ps, SensorObject target) 140 | { 141 | var Ht = this.hunger; 142 | var internalUrge = ps.Lx(ps.timeSinceLastMating) * (1 - Ht); 143 | var externalStimuli = this.Sl(target); 144 | 145 | var L = math.min(internalUrge + externalStimuli, 1); 146 | 147 | this.libido = L; 148 | 149 | return this.libido; 150 | } 151 | 152 | private float F(float t, PhysicalState ps, List targets) 153 | { 154 | var externalStimuli = 0f; 155 | var internalUrge = 0; 156 | foreach(var p in targets) 157 | { 158 | externalStimuli += ps.Fi(p.distance); 159 | } 160 | 161 | var F = math.min(internalUrge + externalStimuli, 1); 162 | 163 | this.fear = F; 164 | 165 | return this.fear; 166 | } 167 | } 168 | [System.Serializable] 169 | 170 | public class PhysicalState 171 | { 172 | public float p_0 = 0.00067f;// Digestion rate 173 | public float alphah = 0.8f; 174 | 175 | public int foodEaten = 0; 176 | public float timeSinceLastMeal = 0; 177 | public float appetite = 1; 178 | public float Rx(float x) { return 1 - p_0 * x; } 179 | 180 | 181 | public float p_1 = 0.0025f;// libido 182 | public float alphal = 0.5f; 183 | 184 | public float timeSinceLastMating = 0; 185 | public float Lx(float x) { return p_1 * x; } 186 | 187 | public float D_0 = 200;//fear constant (D_0=500 => cowards) 188 | public float Fi(float di) { return math.min(D_0 / di, 1); } 189 | 190 | public void UpdateTime(float t) 191 | { 192 | this.timeSinceLastMeal += t; 193 | this.timeSinceLastMating += t; 194 | } 195 | public void Eat(int foodNum) 196 | { 197 | this.foodEaten += foodNum; 198 | this.timeSinceLastMeal = 0; 199 | } 200 | } 201 | } -------------------------------------------------------------------------------- /Assets/Scripts/Common/FishBrain.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fb47550cdc14b941bb338a5baf7f8d6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Common/FishController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityTools.Algorithm; 7 | using UnityTools.Common; 8 | 9 | namespace UnityFishSimulation 10 | { 11 | public class FishController : MonoBehaviour, FishLauncher.ILauncherUser 12 | { 13 | public enum SolverType 14 | { 15 | Euler, 16 | Matrix, 17 | } 18 | 19 | public Environment Runtime { get; set; } 20 | public int Order => (int)FishLauncher.LauncherOrder.Default; 21 | public void OnLaunchEvent(FishLauncher.Data data, Launcher.LaunchEvent levent) 22 | { 23 | switch (levent) 24 | { 25 | case FishLauncher.LaunchEvent.Init: 26 | { 27 | this.Init(); 28 | } 29 | break; 30 | default: 31 | break; 32 | } 33 | } 34 | 35 | protected FishBody body; 36 | protected FishBrain brain; 37 | protected Perception perception; 38 | 39 | protected LinkedList muscleMCs = new LinkedList(); 40 | [SerializeField] protected BalanceMC balanceMC; 41 | 42 | [SerializeField] protected string currentMC; 43 | [SerializeField] protected SwimMC swim; 44 | [SerializeField] protected TurnLeftMC turn; 45 | 46 | protected SolverType solverType = SolverType.Euler; 47 | protected IAlgorithm solver; 48 | 49 | protected FishSimulator.Delta localDelta; 50 | protected FishLogger logger; 51 | 52 | [SerializeField] protected FishActivationData customData; 53 | [SerializeField] public List runtimeList; 54 | [SerializeField] public List runtimeMuscleList; 55 | [SerializeField] public List runtimeSpringList; 56 | [SerializeField] public List runtimeFinList; 57 | 58 | // public FishBrain Brain => this.brain; 59 | 60 | // public bool IsDone { get; set; } 61 | 62 | public void Init() 63 | { 64 | this.body = this.GetComponentInChildren(); 65 | this.body.Init(); 66 | 67 | this.brain = this.GetComponentInChildren(); 68 | this.brain.Init(); 69 | 70 | this.perception = this.GetComponentInChildren(); 71 | this.perception.Init(); 72 | 73 | this.logger = this.logger ?? new FishLogger(); 74 | this.localDelta = this.localDelta ?? new FishSimulator.Delta(); 75 | 76 | this.Reset(); 77 | FishSimulatorRunner.Instance.Controller.AddController(this); 78 | 79 | } 80 | public void Reset() 81 | { 82 | //TODO move load to Body 83 | this.body.modelData = GeometryFunctions.Load(); 84 | 85 | if (this.solverType == SolverType.Euler) 86 | { 87 | this.solver = new FishEulerSolver(); 88 | } 89 | else 90 | { 91 | this.solver = new FishMatrixSolver(); 92 | } 93 | this.localDelta.Reset(); 94 | this.muscleMCs.Clear(); 95 | 96 | this.runtimeList = this.body.modelData.FishGraph.Nodes.ToList(); 97 | this.runtimeSpringList = this.body.modelData.FishGraph.Edges.ToList(); 98 | this.runtimeMuscleList = this.body.modelData.GetSpringByType( 99 | new List{ 100 | Spring.Type.MuscleBack, 101 | Spring.Type.MuscleMiddle, 102 | Spring.Type.MuscleFront } 103 | ); 104 | 105 | this.runtimeFinList = this.body.modelData.FishPectoralFins; 106 | } 107 | 108 | protected void UpdatePerception(FishSimulator.Delta delta) 109 | { 110 | this.perception.SensorUpdate(delta); 111 | } 112 | protected void UpdateBrain(FishSimulator.Delta delta) 113 | { 114 | this.brain.UpdateBrain(delta, this.perception); 115 | } 116 | protected void UpdateFocusser(FishSimulator.Delta delta) 117 | { 118 | this.perception.FocusserUpdate(this.brain.CurrentIntension, this.brain.CurrentDesire, this.body); 119 | } 120 | protected void UpdateMotorController(FishSimulator.Delta delta) 121 | { 122 | var behaviorRoutine = this.GenerateBehaviorRoutine(this.brain.CurrentIntension, this.perception); 123 | 124 | foreach (var mc in behaviorRoutine.ToMC()) 125 | { 126 | if(mc is MuscleMC) 127 | { 128 | var mmc = mc as MuscleMC; 129 | if(this.muscleMCs.Count > 1) 130 | { 131 | this.muscleMCs.RemoveLast(); 132 | } 133 | this.muscleMCs.AddLast(mmc); 134 | } 135 | if(mc is BalanceMC) 136 | { 137 | this.balanceMC = mc as BalanceMC; 138 | } 139 | } 140 | 141 | this.ApplyBehaviorRoutine(delta); 142 | } 143 | protected BehaviorRoutine GenerateBehaviorRoutine(Intension intension, Perception perception) 144 | { 145 | //MC logical 146 | var ret = new BehaviorRoutine(); 147 | ret.Init(intension, perception, this.body); 148 | 149 | return ret; 150 | } 151 | protected void ApplyBehaviorRoutine(FishSimulator.Delta delta) 152 | { 153 | var types = new List() { Spring.Type.MuscleFront, Spring.Type.MuscleMiddle, Spring.Type.MuscleBack }; 154 | 155 | // foreach (var mc in this.muscleMCs) 156 | var mc = this.muscleMCs.FirstOrDefault(); 157 | if(mc != null) 158 | { 159 | var data = mc.ActivationData; 160 | 161 | foreach (var type in types) 162 | { 163 | //get motor controller from brain 164 | var parameter = mc.GetParameter(type); 165 | 166 | data.ApplyActivation(delta.local, type, this.body.modelData, parameter); 167 | } 168 | if(data.IsDone) 169 | { 170 | delta.local = 0; 171 | this.muscleMCs.RemoveFirst(); 172 | } 173 | } 174 | 175 | if(this.balanceMC != null) 176 | { 177 | var lfin = this.body.modelData.FishPectoralFins[0]; 178 | var rfin = this.body.modelData.FishPectoralFins[1]; 179 | 180 | lfin.Angle = math.lerp(lfin.Angle, this.balanceMC.lFin, 0.1f); 181 | rfin.Angle = math.lerp(rfin.Angle, this.balanceMC.rFin, 0.1f); 182 | } 183 | 184 | //Debug data 185 | var fmc = this.muscleMCs.FirstOrDefault(); 186 | if(fmc != null) 187 | { 188 | if (fmc is SwimMC) this.swim = fmc as SwimMC; 189 | if (fmc is TurnLeftMC) this.turn = fmc as TurnLeftMC; 190 | this.currentMC = fmc.ToString(); 191 | } 192 | else 193 | { 194 | this.currentMC = "None"; 195 | } 196 | } 197 | 198 | protected void UpdateBody(FishSimulator.Delta delta) 199 | { 200 | this.solver.Solve(new FishStructureProblem() { fish = body.modelData, dt = delta.deltaTime }); 201 | } 202 | 203 | protected void UpdateSolution(FishSimulator.Delta delta, FishSimulator.Solution solution) 204 | { 205 | // if (this.controlMode == ControlMode.Normal) 206 | // { 207 | 208 | // } 209 | // else 210 | // { 211 | // var data = this.customData.Interval; 212 | // this.IsDone = delta.current > data.y; 213 | // } 214 | /*var data = this.brain.Current; 215 | this.IsDone = delta.current > data.Interval.y; 216 | */ 217 | 218 | // if (this.IsDone) delta.Reset(); 219 | 220 | /*return; 221 | if (delta.current > this.trajactory.GetValueX(this.currentIndex)) 222 | { 223 | this.trajactory[this.currentIndex] = this.body.modelData.Head.Position; 224 | this.velocity[this.currentIndex] = this.body.modelData.Velocity; 225 | this.currentIndex++; 226 | }*/ 227 | 228 | this.logger.Log(this.body.modelData, delta.current); 229 | } 230 | 231 | public void MainUpdate(FishSimulator.Delta delta, FishSimulator.Solution solution) 232 | { 233 | this.localDelta.current += delta.deltaTime; 234 | this.localDelta.local += delta.deltaTime; 235 | this.localDelta.deltaTime = delta.deltaTime; 236 | 237 | this.UpdatePerception(this.localDelta); 238 | this.UpdateBrain(this.localDelta); 239 | this.UpdateFocusser(this.localDelta); 240 | this.UpdateMotorController(this.localDelta); 241 | this.UpdateBody(this.localDelta); 242 | this.UpdateSolution(this.localDelta, solution); 243 | } 244 | } 245 | } 246 | 247 | -------------------------------------------------------------------------------- /Assets/Scripts/Common/FishController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca49ee74ca9b85547bcf93819def2d4f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/External.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ac49a479a07e9b499a2867fd296e599 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/External/DSPLib.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad2e456ac5b544b4ebbb9f1cc14a04d3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FFTTest.cs: -------------------------------------------------------------------------------- 1 | using DSPLib; 2 | using System; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Numerics; 7 | using Unity.Mathematics; 8 | using UnityEngine; 9 | using UnityTools.Common; 10 | using UnityTools.Math; 11 | using static UnityFishSimulation.FishControlOptimizer; 12 | 13 | namespace UnityFishSimulation 14 | { 15 | public class FFTTest : MonoBehaviour 16 | { 17 | protected FishActivationData activationData = null; 18 | [SerializeField] protected AnimationCurve curve; 19 | [SerializeField] protected AnimationCurve curve2; 20 | [SerializeField] protected double[] An; 21 | [SerializeField] protected double[] Pn; 22 | 23 | /*protected float GetFx(double[] An, double[] Pn, float x, int level = 1) 24 | { 25 | var orderedAn = An.OrderByDescending(a=>a).ToList(); 26 | 27 | var count = 0; 28 | var ret = 0f; 29 | for(int i = 0; i < An.Length && count++ < level+1; ++i) 30 | { 31 | var an = orderedAn[i]; 32 | var id = An.ToList().IndexOf(an); 33 | var pn = Pn[id]; 34 | 35 | if (math.abs(an) <= 0.01f) continue; 36 | ret += (float)(an * math.cos(id * x + pn)); 37 | } 38 | return ret; 39 | }*/ 40 | public SAProblem LoadData(string fileName = "SAProblem.data") 41 | { 42 | var path = System.IO.Path.Combine(Application.streamingAssetsPath, fileName); 43 | var ret = FileTool.Read(path); 44 | //LogTool.Log("Loaded " + path); 45 | 46 | return ret; 47 | } 48 | protected void Start() 49 | { 50 | var sampleNum = 15; 51 | var inteval = new float2(0, 30); 52 | 53 | var sa = this.LoadData(); 54 | this.activationData = (sa.Current as SAProblem.ActivationState.Data).ActivationData; 55 | 56 | this.activationData = FishActivationData.Load(); 57 | 58 | // var act = this.activationData.ToDiscreteFunctions()[0]; 59 | /*for(var i = 0; i < act.SampleNum; ++i) 60 | { 61 | //act[i] = math.sin(2 * math.PI * i / (act.SampleNum-1) * 4); 62 | act[i] = 0; 63 | } 64 | 65 | act[3] = act[4] = 1; 66 | act[9] = act[10] = 1; 67 | 68 | this.curve = act.ToAnimationCurve(); 69 | 70 | var vector = act.ToYVector(); 71 | 72 | var array = vector.Select(s=>(double)s).ToArray(); 73 | var dft = new DFT(); 74 | 75 | dft.Initialize((uint)array.Length); 76 | 77 | // Call the DFT and get the scaled spectrum back 78 | Complex[] cSpectrum = dft.Execute(array); 79 | 80 | An = DSP.ConvertComplex.ToMagnitude(cSpectrum); 81 | Pn = DSP.ConvertComplex.ToPhaseRadians(cSpectrum); 82 | 83 | var maxAn = An.Max(); 84 | var maxIndex = An.ToList().IndexOf(maxAn); 85 | var maxPn = Pn[maxIndex]; 86 | 87 | var start = new Tuple(inteval.x, 0); 88 | var end = new Tuple(inteval.y, 0); 89 | var function = new X2FDiscreteFunction(start, end, sampleNum); 90 | 91 | for (var i = 0; i < function.SampleNum; ++i) 92 | { 93 | var x = 2 * math.PI * i / (act.SampleNum - 1); 94 | //function[i] = (float)(An[0] / 2 + maxAn * math.cos(maxIndex * x + maxPn)); 95 | //function[i] = FishActivationData.GetFx(An, Pn, x, 1); 96 | } 97 | 98 | this.curve2 = function.ToAnimationCurve(); 99 | */ 100 | } 101 | } 102 | } -------------------------------------------------------------------------------- /Assets/Scripts/FFTTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd681be57b821ec458ea661a409a101b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FIshActivationData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7faa142b22519d84d9e8f4914f568eed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishActivationAdjustment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using UnityEngine; 6 | using UnityTools.Algorithm; 7 | using UnityTools.Attributes; 8 | 9 | namespace UnityFishSimulation 10 | { 11 | public class FishActivationAdjustment : MonoBehaviour 12 | { 13 | public enum MCType 14 | { 15 | Swim, 16 | TurnLeft, 17 | TurnRight, 18 | } 19 | [SerializeField] protected MCType type = MCType.Swim; 20 | [SerializeField] protected bool fft = false; 21 | [SerializeField] protected bool loop = true; 22 | [SerializeField] protected List curves = new List(); 23 | [SerializeField] protected List tunings = new List(); 24 | 25 | protected FishActivationData Activation => this.GetCurrentMC().ActivationData; 26 | [SerializeField] protected SwimMC smc; 27 | [SerializeField] protected TurnLeftMC lmc; 28 | [SerializeField] protected TurnRightMC rmc; 29 | protected FishBody fish; 30 | protected FishSimulatorOffline sim; 31 | protected FishSimulatorOffline.Problem problem; 32 | protected IterationDelta delta; 33 | 34 | protected void Start() 35 | { 36 | this.fish = this.GetComponent(); 37 | this.fish.Init(); 38 | 39 | this.InitActivations(); 40 | this.UpdateAnimationCurves(); 41 | this.problem = new FishSimulatorOffline.Problem(this.fish, this.GetCurrentMC()); 42 | this.delta = new IterationDelta(); 43 | this.sim = new FishSimulatorOffline(problem, this.delta); 44 | this.sim.TryToRun(); 45 | } 46 | protected void Update() 47 | { 48 | foreach(var a in this.Activation.ToActivationList()) 49 | { 50 | a.Tuning.useFFT = this.fft; 51 | } 52 | if(this.loop && (this.sim.CurrentSolution as FishSimulatorOffline.Solution).IsDone) 53 | { 54 | this.sim.Restart(); 55 | } 56 | if(Input.GetKeyDown(KeyCode.S)) 57 | { 58 | FishActivationData.Save(this.Activation); 59 | } 60 | } 61 | 62 | protected MuscleMC GetCurrentMC() 63 | { 64 | switch (this.type) 65 | { 66 | case MCType.Swim: return this.smc; 67 | case MCType.TurnLeft: return this.lmc; 68 | case MCType.TurnRight: return this.rmc; 69 | default: return this.smc; 70 | } 71 | } 72 | protected void InitActivations() 73 | { 74 | this.smc = new SwimMC(); 75 | this.lmc = new TurnLeftMC(); 76 | this.rmc = new TurnRightMC(); 77 | } 78 | 79 | protected void UpdateAnimationCurves() 80 | { 81 | this.curves = this.Activation.ToAnimationCurves(); 82 | this.tunings = this.Activation.ToActivationList().Select(a=>a.Tuning).ToList(); 83 | } 84 | 85 | protected void UpdateActivationDataFromCurves() 86 | { 87 | var act = this.Activation.ToActivationList(); 88 | for (var i = 0; i < this.curves.Count; i += 2) 89 | { 90 | act[i / 2].FromAnimationCurve(this.curves[i]); 91 | } 92 | this.UpdateAnimationCurves(); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Assets/Scripts/FishActivationAdjustment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a254a6b8f826a8448af32ffeeea1a8f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f38b573a5a44454b8e2bba939e78a55 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishFood.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | namespace UnityFishSimulation 7 | { 8 | public class FishFood : MonoBehaviour, ISensorableObject 9 | { 10 | public float3 Position => this.transform.position; 11 | 12 | public float Size => 1; 13 | 14 | public ObjectType ObjType => ObjectType.Food; 15 | 16 | public float GetDistance(ISensorableObject other) 17 | { 18 | return math.distance(this.Position, other.Position); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/Scripts/FishFood.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 360d96f8ee41d9447b47d51949a33875 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishLauncher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityTools.Common; 6 | 7 | namespace UnityFishSimulation 8 | { 9 | public class FishLauncher : Launcher 10 | { 11 | [Serializable] 12 | public class Data 13 | { 14 | } 15 | 16 | protected override void ConfigureEnvironment() 17 | { 18 | base.ConfigureEnvironment(); 19 | 20 | #if !DEBUG 21 | this.environment.runtime = Environment.Runtime.Production; 22 | #endif 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/Scripts/FishLauncher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b72818c26ad46f447a01a46d7d94672b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishMC.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | namespace UnityFishSimulation 7 | { 8 | public class FishMC : MonoBehaviour 9 | { 10 | public enum Type 11 | { 12 | Swimming, 13 | TurnRight 14 | } 15 | [SerializeField] Type type = Type.Swimming; 16 | 17 | public List curves; 18 | protected void Start() 19 | { 20 | } 21 | /*[SerializeField] protected FishController fishMC; 22 | 23 | [SerializeField, Range(0, 3.14f)] protected float Langle = math.PI / 2; 24 | [SerializeField, Range(0, 3.14f)] protected float Rangle = math.PI / 2; 25 | [SerializeField] protected FishSimulator sim; 26 | 27 | protected void Start() 28 | { 29 | fishMC = new FishController(); 30 | / *sim = new FishSimulator(FishSimulator.SolverType.Euler, this.fishMC, new FishSimulator.Delta()); 31 | sim.End((p, s, d, a) => sim.TryToRun()); 32 | 33 | sim.ResetAndRun();* / 34 | } 35 | 36 | protected void Update() 37 | { 38 | if(Input.GetKeyDown(KeyCode.S)) 39 | { 40 | FishActivationData.Save(this.fishMC.Current); 41 | } 42 | / *if (Input.GetKeyDown(KeyCode.R)) 43 | { 44 | this.fishMC.ReloadData(); 45 | } 46 | 47 | this.sim.runtimeFinList[0].Anlge = Langle; 48 | this.sim.runtimeFinList[1].Anlge = Langle;* / 49 | } 50 | 51 | protected void OnDrawGizmos() 52 | { 53 | }*/ 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Assets/Scripts/FishMC.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21b38903011d3d548bda19aad4935fdd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | using UnityTools; 6 | using UnityTools.Common; 7 | 8 | namespace UnityFishSimulation 9 | { 10 | public enum ObjectType 11 | { 12 | Predator, 13 | Prey, 14 | Obstacle, 15 | Food, 16 | Mate, 17 | } 18 | public interface ISensorableObject 19 | { 20 | float3 Position { get; } 21 | float Size { get; } 22 | ObjectType ObjType { get; } 23 | float GetDistance(ISensorableObject other); 24 | } 25 | public interface IDebug 26 | { 27 | bool DrawGizmo { get; set; } 28 | } 29 | public class FishManager : MonoBehaviour, FishLauncher.ILauncherUser 30 | { 31 | public interface IManagerUser 32 | { 33 | FishManager Manager { get; set; } 34 | } 35 | 36 | public Environment Runtime { get; set; } 37 | 38 | public int Order => (int)FishLauncher.LauncherOrder.LowLevel; 39 | 40 | [SerializeField] protected GameObject fishPrefab; 41 | 42 | public List SensorableObjects => this.sensorableObjectsList; 43 | [SerializeField] protected List sensorableObjectsList = new List(); 44 | 45 | public void OnLaunchEvent(FishLauncher.Data data, Launcher.LaunchEvent levent) 46 | { 47 | switch (levent) 48 | { 49 | case FishLauncher.LaunchEvent.Init: 50 | { 51 | this.sensorableObjectsList.Clear(); 52 | this.sensorableObjectsList.AddRange(ObjectTool.FindAllObject()); 53 | this.SetupUser(); 54 | } 55 | break; 56 | default: 57 | break; 58 | } 59 | } 60 | 61 | protected void SetupUser() 62 | { 63 | foreach (var user in this.GetComponentsInChildren()) user.Manager = this; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /Assets/Scripts/FishManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 442a1675c450f4e47abb41229807c3f1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishModelPreview.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Unity.Mathematics; 6 | using UnityEngine; 7 | using UnityTools.Algorithm; 8 | using UnityTools.Attributes; 9 | using UnityTools.Debuging.EditorTool; 10 | using UnityTools.Math; 11 | 12 | namespace UnityFishSimulation 13 | { 14 | public class FishModelPreview : MonoBehaviour 15 | { 16 | public enum ControlMode 17 | { 18 | Manual, 19 | Activations, 20 | Random, 21 | CosSwim, 22 | CosTrun, 23 | } 24 | 25 | [SerializeField, FileNamePopup("*.ad")] protected string activationFileName = "Swimming"; 26 | [SerializeField] protected ControlMode mode = ControlMode.Activations; 27 | [SerializeField] protected IterationAlgorithmMode stepMode = IterationAlgorithmMode.FullStep; 28 | [SerializeField, Range(-1, 1)] protected float activation = 0f; 29 | [SerializeField] protected float2 timeInterval = new float2(0, 20); 30 | [SerializeField] protected int sampleNum = 15; 31 | [SerializeField] protected bool fft = false; 32 | [SerializeField] protected bool loop = true; 33 | [SerializeField] protected List curves = new List(); 34 | [SerializeField] protected List runtimeList; 35 | 36 | 37 | protected FishActivationData activationData; 38 | protected FishBody fish; 39 | protected FishSimulatorOffline sim; 40 | protected FishSimulatorOffline.Problem problem; 41 | protected IterationDelta delta; 42 | 43 | public bool useJellyFish = false; 44 | 45 | protected void InitActivations() 46 | { 47 | if (this.mode == ControlMode.Random || this.mode == ControlMode.Manual) 48 | { 49 | if (this.useJellyFish) 50 | { 51 | this.activationData = new FishActivationDataJellyfish(this.timeInterval, this.sampleNum, true); 52 | } 53 | else 54 | { 55 | this.activationData = new FishActivationDataSwimming(this.timeInterval, this.sampleNum, true); 56 | } 57 | this.activationData.RandomActivation(); 58 | } 59 | else 60 | if (this.mode == ControlMode.Activations) 61 | { 62 | this.activationData = FishActivationData.Load(this.activationFileName); 63 | } 64 | else 65 | if(this.mode == ControlMode.CosSwim) 66 | { 67 | this.activationData = new FishActivationDataSwimming(this.timeInterval, this.sampleNum, true); 68 | var ml = this.activationData[Spring.Type.MuscleMiddle, Spring.Side.Left]; 69 | var bl = this.activationData[Spring.Type.MuscleBack, Spring.Side.Left]; 70 | for(var i = 0; i < this.sampleNum;++i) 71 | { 72 | var x = i * 1f / (this.sampleNum - 1) * 2 * math.PI; 73 | ml.DiscreteFunction[i] = math.sin(x); 74 | bl.DiscreteFunction[i] = math.sin(x + math.PI); 75 | } 76 | ml.FFT.GenerateFFTData(); 77 | bl.FFT.GenerateFFTData(); 78 | } 79 | else 80 | if(this.mode == ControlMode.CosTrun) 81 | { 82 | var ar = FishActivationData.Load("TurnRight"); 83 | 84 | this.activationData = new FishActivationDataTurnLeft(this.timeInterval, this.sampleNum, true); 85 | var fl = this.activationData[Spring.Type.MuscleFront, Spring.Side.Left]; 86 | var ml = this.activationData[Spring.Type.MuscleMiddle, Spring.Side.Left]; 87 | var afl = ar[Spring.Type.MuscleFront, Spring.Side.Left]; 88 | var aml = ar[Spring.Type.MuscleMiddle, Spring.Side.Left]; 89 | for(var i = 1; i < this.sampleNum;++i) 90 | { 91 | var x = i * 1f / (this.sampleNum - 1) * 2 * math.PI; 92 | if(i < this.sampleNum/3) 93 | { 94 | // ml.DiscreteFunction[i] = -math.sin(x*3); 95 | // fl.DiscreteFunction[i] = -math.sin(x*3); 96 | } 97 | fl.DiscreteFunction[i] = -afl.DiscreteFunction[i]; 98 | ml.DiscreteFunction[i] = -aml.DiscreteFunction[i]; 99 | } 100 | ml.FFT.GenerateFFTData(); 101 | fl.FFT.GenerateFFTData(); 102 | 103 | } 104 | } 105 | 106 | protected void UpdateAnimationCurves() 107 | { 108 | this.curves = this.activationData.ToAnimationCurves(); 109 | } 110 | 111 | protected void UpdateActivationDataFromCurves() 112 | { 113 | var act = this.activationData.ToActivationList(); 114 | for(var i = 0; i < this.curves.Count; i+=2) 115 | { 116 | act[i/2].FromAnimationCurve(this.curves[i]); 117 | } 118 | this.UpdateAnimationCurves(); 119 | } 120 | 121 | protected void Start() 122 | { 123 | this.fish = this.GetComponent(); 124 | this.fish.Init(); 125 | this.runtimeList = this.fish.modelData.FishGraph.Nodes.ToList(); 126 | 127 | 128 | this.InitActivations(); 129 | this.UpdateAnimationCurves(); 130 | this.problem = new FishSimulatorOffline.Problem(this.fish.modelData, this.activationData); 131 | this.delta = new IterationDelta(); 132 | this.sim = new FishSimulatorOffline(problem, this.delta); 133 | this.sim.TryToRun(); 134 | } 135 | 136 | protected void Update() 137 | { 138 | if (this.mode == ControlMode.Manual) 139 | { 140 | var types = new List() { Spring.Type.MuscleMiddle, Spring.Type.MuscleBack}; 141 | foreach (var t in types) 142 | { 143 | this.activationData.SetActivationValue(t, Spring.Side.Left, this.activation); 144 | this.activationData.SetActivationValue(t, Spring.Side.None, this.activation); 145 | // a.Tuning.useFFT = false; 146 | // a.DiscreteFunction.ResetValues(this.activation); 147 | // a = this.activationData[t, Spring.Side.Right]; 148 | // a.Tuning.useFFT = false; 149 | // var ra = (this.activation + 1) * 0.5f; 150 | // ra = 1 - ra; 151 | // ra = ra * 2 - 1; 152 | // a.DiscreteFunction.ResetValues(ra); 153 | } 154 | } 155 | 156 | this.sim.RunMode = this.stepMode; 157 | if(Input.GetKey(KeyCode.Space) && this.stepMode == IterationAlgorithmMode.PerStep) 158 | { 159 | this.sim.TryToRun(); 160 | } 161 | 162 | foreach(var a in this.activationData.ToActivationList()) 163 | { 164 | a.Tuning.useFFT = this.fft; 165 | } 166 | if(this.loop && (this.sim.CurrentSolution as FishSimulatorOffline.Solution).IsDone) 167 | { 168 | this.sim.Restart(); 169 | } 170 | if(Input.GetKeyDown(KeyCode.S)) 171 | { 172 | FishActivationData.Save(this.activationData); 173 | } 174 | 175 | if (Input.GetKey(KeyCode.R)) 176 | { 177 | this.fish.Init(); 178 | this.runtimeList = this.fish.modelData.FishGraph.Nodes.ToList(); 179 | this.problem.UpdateData(this.fish.modelData, this.activationData); 180 | this.sim.Restart(); 181 | } 182 | if (Input.GetKeyDown(KeyCode.U)) 183 | { 184 | this.UpdateActivationDataFromCurves(); 185 | } 186 | 187 | if (Input.GetKeyDown(KeyCode.G)) 188 | { 189 | this.activationData.RandomActivation(); 190 | this.UpdateAnimationCurves(); 191 | } 192 | } 193 | 194 | protected void OnDrawGizmos() 195 | { 196 | var sol = this.sim?.CurrentSolution as FishSimulatorOffline.Solution; 197 | using (new GizmosScope(Color.white, this.transform.localToWorldMatrix)) 198 | { 199 | if (sol != null) 200 | { 201 | var logPos = sol.logger.LogData.trajectory.ToYVector(); 202 | for (var i = 0; i < logPos.Size - 1; ++i) 203 | { 204 | Gizmos.DrawLine(logPos[i], logPos[i + 1]); 205 | } 206 | } 207 | } 208 | } 209 | 210 | } 211 | } 212 | 213 | -------------------------------------------------------------------------------- /Assets/Scripts/FishModelPreview.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d2256d7c43041443a14b36043d67268 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishMotorController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | namespace UnityFishSimulation 6 | { 7 | /*[Serializable] 8 | public class FishSwimmingMC : FishSimulator.Problem 9 | { 10 | [SerializeField] protected float speed = 1; 11 | [SerializeField] protected List curves = new List(); 12 | [SerializeField] protected List tuningData; 13 | 14 | public FishSwimmingMC() : base() 15 | { 16 | this.tuningData = this.fishActivationDatas.Select(d => d.Tuning).ToList(); 17 | 18 | this.curves.Clear(); 19 | this.curves.AddRange(this.Current.ToAnimationCurves()); 20 | } 21 | 22 | public override void ReloadData() 23 | { 24 | this.fish = this.fish ?? GeometryFunctions.Load(); 25 | this.curves.Clear(); 26 | this.curves.AddRange(this.Current.ToAnimationCurves()); 27 | } 28 | } 29 | 30 | [Serializable] 31 | public class FishTurnMC : FishSimulator.Problem 32 | { 33 | //left is negative 34 | //right is positive 35 | [SerializeField] protected int angle = 0; 36 | 37 | [SerializeField] protected List curves = new List(); 38 | [SerializeField] protected List tuningData; 39 | 40 | public FishTurnMC() : base(FishActivationData.Load("TurnRight")) 41 | { 42 | this.tuningData = this.fishActivationDatas.Select(d => d.Tuning).ToList(); 43 | this.Current.GenerateFFTData(); 44 | } 45 | 46 | public override void ReloadData() 47 | { 48 | this.fish = this.fish ?? GeometryFunctions.Load(); 49 | this.curves.Clear(); 50 | this.curves.AddRange(this.Current.ToAnimationCurves()); 51 | } 52 | }*/ 53 | } 54 | -------------------------------------------------------------------------------- /Assets/Scripts/FishMotorController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27190fc8009bee5448d6e40413ad49c6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishSimulator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Unity.Mathematics; 6 | using UnityEngine; 7 | using UnityTools; 8 | using UnityTools.Algorithm; 9 | using UnityTools.Debuging; 10 | using UnityTools.Math; 11 | 12 | namespace UnityFishSimulation 13 | { 14 | [Serializable] 15 | public class FishLogger 16 | { 17 | [Serializable] 18 | public class Data 19 | { 20 | internal protected DiscreteFunction trajectory = new DiscreteFunction(); 21 | internal protected DiscreteFunction velocity = new DiscreteFunction(); 22 | internal protected DiscreteFunction direction = new DiscreteFunction(); 23 | internal protected int currentIndex; 24 | } 25 | 26 | public Data LogData=>this.logData; 27 | protected Data logData = new Data(); 28 | protected float sampleInterval = 0.5f; 29 | protected float current = 0; 30 | public void Log(FishModelData bodyModel, float current) 31 | { 32 | if(current > this.current) 33 | { 34 | this.logData.trajectory.Append(current, bodyModel.Head.Position); 35 | this.logData.velocity.Append(current, bodyModel.Velocity); 36 | this.logData.direction.Append(current, bodyModel.Direction); 37 | this.current += this.sampleInterval; 38 | } 39 | } 40 | } 41 | 42 | [Serializable] 43 | public class FishSimulator : SimulatorMono 44 | { 45 | /*public static ControllerProblem FishControllerProblem => fishSimulator.problem as ControllerProblem; 46 | public static FishSimulator Instance => fishSimulator; 47 | protected static FishSimulator fishSimulator = new FishSimulator(new ControllerProblem(), new Delta());*/ 48 | 49 | [Serializable] 50 | public class ControllerProblem: IProblem 51 | { 52 | public LinkedList CurrentQueue => this.fishControllers; 53 | protected LinkedList fishControllers = new LinkedList(); 54 | 55 | public void AddController(FishController controller) 56 | { 57 | LogTool.AssertIsFalse(this.CurrentQueue.Contains(controller)); 58 | this.CurrentQueue.AddLast(controller); 59 | } 60 | } 61 | [Serializable] 62 | public class Solution : ISolution 63 | { 64 | 65 | } 66 | 67 | [Serializable] 68 | public class Delta : IDelta 69 | { 70 | protected const float dt = 0.055f; 71 | public float current; 72 | public float local; 73 | public float deltaTime; 74 | public void Reset() 75 | { 76 | this.current = 0; 77 | this.local = 0; 78 | } 79 | 80 | public void Step() 81 | { 82 | this.current += Time.deltaTime; 83 | this.deltaTime = Time.deltaTime; 84 | } 85 | } 86 | 87 | public void OnInit( 88 | IProblem problem, 89 | IDelta dt, 90 | IterationAlgorithmMode mode = IterationAlgorithmMode.FullStep) 91 | { 92 | this.Init(problem,dt,mode); 93 | } 94 | 95 | public override bool IsSolutionAcceptable(ISolution solution) 96 | { 97 | return false; 98 | } 99 | 100 | public override ISolution Solve(IProblem problem) 101 | { 102 | var d = this.dt as Delta; 103 | var s = this.CurrentSolution as Solution; 104 | var p = problem as ControllerProblem; 105 | foreach (var c in p.CurrentQueue) 106 | { 107 | c.MainUpdate(d, s); 108 | } 109 | 110 | return this.CurrentSolution; 111 | } 112 | 113 | public void ResetAndRun() 114 | { 115 | var p = problem as ControllerProblem; 116 | foreach (var c in p.CurrentQueue) 117 | { 118 | c.Reset(); 119 | } 120 | 121 | this.Reset(); 122 | this.TryToRun(); 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /Assets/Scripts/FishSimulator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba92077a440bf1d41a332d4b3adb0ae2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishSimulatorRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityTools.Common; 5 | 6 | namespace UnityFishSimulation 7 | { 8 | public class FishSimulatorRunner : SingletonMonoBehaviour, FishLauncher.ILauncherUser 9 | { 10 | [SerializeField] protected FishSimulator simulator; 11 | [SerializeField] protected FishSimulator.ControllerProblem problem; 12 | [SerializeField] protected FishSimulator.Delta delta; 13 | 14 | public FishSimulator.ControllerProblem Controller => this.problem; 15 | 16 | public Environment Runtime { get; set; } 17 | 18 | public int Order => (int)FishLauncher.LauncherOrder.LowLevel; 19 | 20 | public void OnLaunchEvent(FishLauncher.Data data, Launcher.LaunchEvent levent) 21 | { 22 | switch (levent) 23 | { 24 | case FishLauncher.LaunchEvent.Init: 25 | { 26 | this.problem = new FishSimulator.ControllerProblem(); 27 | this.delta = new FishSimulator.Delta(); 28 | 29 | //this.simulator = new FishSimulator(this.problem, this.delta); 30 | this.simulator = this.GetComponent(); 31 | this.simulator.OnInit(this.problem, this.delta); 32 | this.simulator.TryToRun(); 33 | } 34 | break; 35 | case FishLauncher.LaunchEvent.DeInit: 36 | { 37 | // this.simulator.Dispose(); 38 | } 39 | break; 40 | default: 41 | break; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Assets/Scripts/FishSimulatorRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 403562aee4dee744cb1133e6d97cd8c8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishSolver.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityEngine.Assertions; 7 | using UnityTools.Algorithm; 8 | using UnityTools.Common; 9 | 10 | namespace UnityFishSimulation 11 | { 12 | public class FishStructureProblem : IProblem 13 | { 14 | public FishModelData fish; 15 | public float dt; 16 | } 17 | [System.Serializable] 18 | public class FishEulerSolver : IAlgorithm 19 | { 20 | [SerializeField, Range(0.01f, 1)] protected float fluidForceScale = 1f; 21 | 22 | public ISolution Solve(IProblem problem) 23 | { 24 | var fishProblem = problem as FishStructureProblem; 25 | var dt = fishProblem.dt; 26 | var fish = fishProblem.fish; 27 | 28 | var step = 100; 29 | dt /= 10; 30 | foreach (var value in Enumerable.Range(0, step)) 31 | { 32 | this.PreSolve(fish); 33 | this.ApplyForces(fish); 34 | this.Intergrate(fish, dt); 35 | this.PostSolve(fish); 36 | } 37 | 38 | return default; 39 | } 40 | 41 | protected void PreSolve(FishModelData fish) 42 | { 43 | foreach (var n in fish.FishGraph.Nodes) n.Force = 0; 44 | } 45 | protected void ApplyForces(FishModelData fish) 46 | { 47 | this.ApplySpringForce(fish); 48 | this.ApplyDumpingForce(fish); 49 | this.ApplyFluidForce(fish); 50 | this.ApplyFinForce(fish); 51 | } 52 | 53 | protected void Intergrate(FishModelData fish, float dt) 54 | { 55 | foreach (var n in fish.FishGraph.Nodes) 56 | { 57 | n.Velocity += (n.Force / n.Mass) * dt; 58 | n.Position += n.Velocity * dt; 59 | } 60 | } 61 | 62 | protected void PostSolve(FishModelData fish) 63 | { 64 | } 65 | 66 | protected void ApplySpringForce(FishModelData fish) 67 | { 68 | foreach (var n in fish.FishGraph.Nodes) 69 | { 70 | var force = this.GetSpringForce(n, fish); 71 | n.Force += force; 72 | } 73 | } 74 | public void ApplyDumpingForce(FishModelData fish) 75 | { 76 | foreach (var n in fish.FishGraph.Nodes) 77 | { 78 | n.Force += -fish.Damping * n.Velocity; 79 | } 80 | } 81 | protected void ApplyFluidForce(FishModelData fish) 82 | { 83 | foreach (var face in fish.FishNormalFace) 84 | { 85 | face.ApplyForceToNode(this.fluidForceScale); 86 | } 87 | } 88 | 89 | protected void ApplyFinForce(FishModelData fish) 90 | { 91 | foreach (var fin in fish.FishPectoralFins) 92 | { 93 | fin.ApplyFinForce(fish.Velocity, fish.Left, fish.Direction); 94 | } 95 | } 96 | 97 | protected float3 GetSpringForce(MassPoint i, FishModelData fish) 98 | { 99 | var neighbors = fish.FishGraph.GetNeighborsNodes(i); 100 | var ret = float3.zero; 101 | 102 | foreach (var j in neighbors) 103 | { 104 | var r = j.Position - i.Position; 105 | var r_ij = math.length(r); 106 | var s_ij = fish.FishGraph.GetEdge(i, j); 107 | Assert.IsNotNull(s_ij); 108 | Assert.IsTrue(i.Index != j.Index); 109 | 110 | var e_ij = r_ij - s_ij.CurrentL; 111 | 112 | var u_ij = j.Velocity - i.Velocity; 113 | var r_dot = (u_ij * r) / r_ij; 114 | 115 | var force_ij = (((s_ij.C * e_ij) + (s_ij.K * r_dot)) / r_ij) * r; 116 | ret += force_ij; 117 | } 118 | 119 | return ret; 120 | } 121 | } 122 | 123 | [System.Serializable] 124 | public class FishMatrixSolver : IAlgorithm 125 | { 126 | [SerializeField, Range(0.01f, 1)] protected float fluidForceScale = 1f; 127 | public ISolution Solve(IProblem problem) 128 | { 129 | var fishProblem = problem as FishStructureProblem; 130 | var dt = fishProblem.dt; 131 | var fish = fishProblem.fish; 132 | 133 | var step = 1; 134 | dt = dt / step; 135 | foreach (var value in Enumerable.Range(0, step)) 136 | { 137 | this.PreSolve(fish); 138 | this.ApplyForces(fish); 139 | this.Intergrate(fish, dt); 140 | this.PostSolve(fish); 141 | } 142 | 143 | return default; 144 | } 145 | 146 | public void PreSolve(FishModelData fish) 147 | { 148 | foreach (var n in fish.FishGraph.Nodes) n.Force = 0; 149 | } 150 | public void ApplyForces(FishModelData fish) 151 | { 152 | this.ApplyFluidForce(fish); 153 | } 154 | 155 | public void Intergrate(FishModelData fish, float dt) 156 | { 157 | //var na = 7; 158 | 159 | var nodes = fish.FishGraph.Nodes.ToList(); 160 | var dim = new int2(nodes.Count, nodes.Count); 161 | 162 | var At = new Matrix(dim.x, dim.y); 163 | var Gt = new Vector(dim.x); 164 | 165 | foreach (var s_ij in fish.FishGraph.Edges) 166 | { 167 | Assert.IsNotNull(s_ij); 168 | 169 | var ni = s_ij.Start; 170 | var nj = s_ij.End; 171 | var i = ni.Index; 172 | var j = nj.Index; 173 | 174 | var n_ij = GetN(ni, nj, s_ij.C, s_ij.K, s_ij.CurrentL); 175 | var r_ij = nj.Position - ni.Position; 176 | 177 | At[i, i] = At[i, i] + n_ij * dt; 178 | At[j, j] = At[j, j] + n_ij * dt; 179 | 180 | At[i, j] = At[j, i] = -n_ij * dt; 181 | 182 | Gt[i] = Gt[i] + n_ij * r_ij; 183 | Gt[j] = Gt[j] - n_ij * r_ij; 184 | } 185 | 186 | 187 | 188 | for (var i = 0; i < nodes.Count; ++i) 189 | { 190 | var mi = nodes[i].Mass; 191 | var fi = nodes[i].Force; 192 | var vi = nodes[i].Velocity; 193 | At[i, i] = At[i, i] + mi / dt; 194 | Gt[i] = Gt[i] + fi + (mi / dt) * vi; 195 | } 196 | 197 | 198 | var L = new Matrix(dim.x, dim.y); 199 | var D = new Matrix(dim.x, dim.y); 200 | var LT = new Matrix(dim.x, dim.y); 201 | for (var i = 0; i < dim.x; ++i) 202 | { 203 | for (var j = 0; j < dim.y; ++j) 204 | { 205 | if (i >= j) L[i, j] = At[i, j]; 206 | if (i == j) D[i, j] = At[i, j]; 207 | if (i <= j) LT[i, j] = At[i, j]; 208 | } 209 | } 210 | 211 | //this.Print(L, "L", true); 212 | //this.Print(D, "D", true); 213 | //this.Print(LT, "LT", true); 214 | 215 | var Q = Solver.SolverFS(L, Gt); 216 | //this.Print(Q, "Q", true); 217 | //D-1Q 218 | for (var i = 0; i < dim.x; ++i) 219 | { 220 | Q[i] *= 1f / D[i, i]; 221 | } 222 | //this.Print(Q, "Q_1", true); 223 | 224 | var X_dot = Solver.SolverBS(LT, Q); 225 | 226 | //this.Print(X_dot, "X_Velocity", true); 227 | 228 | foreach (var n in fish.FishGraph.Nodes) 229 | { 230 | n.Velocity = X_dot[n.Index]; 231 | n.Position += n.Velocity * dt; 232 | } 233 | } 234 | 235 | public void PostSolve(FishModelData fish) 236 | { 237 | } 238 | protected void ApplyFluidForce(FishModelData fish) 239 | { 240 | foreach (var face in fish.FishNormalFace) 241 | { 242 | face.ApplyForceToNode(this.fluidForceScale); 243 | } 244 | } 245 | 246 | protected float3 GetN(MassPoint i, MassPoint j, float c, float k, float l) 247 | { 248 | var r = j.Position - i.Position; 249 | var r_ij = math.length(r); 250 | 251 | var e_ij = r_ij - l; 252 | 253 | var u_ij = j.Velocity - i.Velocity; 254 | var r_dot = math.dot(u_ij, r) / r_ij; 255 | 256 | var n_ij = ((c * e_ij) + (k * r_dot)) / r_ij; 257 | 258 | return n_ij; 259 | } 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /Assets/Scripts/FishSolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b59a02bb17a46b4a9f0002e535bef48 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/FishTurn.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | namespace UnityFishSimulation 7 | { 8 | public class FishTurn : MonoBehaviour 9 | { 10 | /*[SerializeField] protected FishController fishMC; 11 | 12 | [SerializeField, Range(0, 3.14f)] protected float angle = math.PI / 2; 13 | [SerializeField] protected FishSimulator sim; 14 | 15 | protected void Start() 16 | { 17 | fishMC = new FishController(); 18 | / *sim = new FishSimulator(FishSimulator.SolverType.Euler, this.fishMC, new FishSimulator.Delta()); 19 | sim.End((p, s, d, a) => sim.TryToRun()); 20 | 21 | sim.ResetAndRun();* / 22 | } 23 | 24 | protected void Update() 25 | { 26 | if (Input.GetKeyDown(KeyCode.S)) 27 | { 28 | FishActivationData.Save(this.fishMC.Current); 29 | } 30 | / *if (Input.GetKeyDown(KeyCode.R)) 31 | { 32 | sim.ResetAndRun(); 33 | }* / 34 | 35 | } 36 | 37 | protected void OnDrawGizmos() 38 | { 39 | 40 | }*/ 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/Scripts/FishTurn.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 965c3c380a414dc42b649905aaa04e94 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Obstacle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | namespace UnityFishSimulation 7 | { 8 | public class Obstacle : MonoBehaviour, ISensorableObject 9 | { 10 | public float3 Position => this.transform.position; 11 | 12 | public float Size => 1; 13 | 14 | public ObjectType ObjType => ObjectType.Obstacle; 15 | 16 | public float GetDistance(ISensorableObject other) 17 | { 18 | return math.distance(this.Position, other.Position); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/Scripts/Obstacle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c0489f7a75bed1489ac02b7e0d7ec35 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Optimizer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6541a85f2877f8b4f81010cad9b6ced0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Optimizer/FIshSimulatorOffline.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | using UnityTools.Algorithm; 6 | 7 | namespace UnityFishSimulation 8 | { 9 | public class FishSimulatorOffline : Simulator 10 | { 11 | public class Problem : IProblem 12 | { 13 | public FishModelData BodyModel => this.bodyModel; 14 | public FishActivationData Activation => this.activationData; 15 | protected FishModelData bodyModel; 16 | protected FishActivationData activationData; 17 | 18 | 19 | public FishBody Body=>this.fishBody; 20 | public MuscleMC MC=>this.mcData; 21 | protected FishBody fishBody; 22 | protected MuscleMC mcData; 23 | 24 | public Problem(FishModelData model, FishActivationData activationData) 25 | { 26 | this.UpdateData(model, activationData); 27 | } 28 | public Problem(FishBody fish, MuscleMC mc) 29 | { 30 | this.fishBody = fish; 31 | this.mcData = mc; 32 | } 33 | public void UpdateData(FishModelData modelData, FishActivationData activationData) 34 | { 35 | this.bodyModel = modelData; 36 | this.activationData = activationData; 37 | } 38 | } 39 | public class Solution : ISolution 40 | { 41 | public bool IsDone = false; 42 | public FishLogger logger = new FishLogger(); 43 | } 44 | public FishSimulatorOffline(IProblem problem, IDelta dt, IterationAlgorithmMode mode = IterationAlgorithmMode.FullStep) : base(problem, dt, mode) 45 | { 46 | this.currentSolution = new Solution(); 47 | } 48 | 49 | public void Restart() 50 | { 51 | this.currentSolution = new Solution(); 52 | this.Reset(); 53 | this.TryToRun(); 54 | } 55 | public override bool IsSolutionAcceptable(ISolution solution) 56 | { 57 | var sol = this.currentSolution as Solution; 58 | return sol.IsDone; 59 | } 60 | 61 | public override ISolution Solve(IProblem problem) 62 | { 63 | var p = problem as Problem; 64 | var idt = this.dt as IterationDelta; 65 | var sol = this.currentSolution as Solution; 66 | var model = p.BodyModel; 67 | var activation = p.Activation; 68 | if(p.BodyModel != null) 69 | { 70 | this.ApplyActivation(idt.Current, p.BodyModel, p.Activation); 71 | } 72 | else 73 | { 74 | this.ApplyActivation(idt.Current, p.Body, p.MC); 75 | model = p.Body.modelData; 76 | activation = p.MC.ActivationData; 77 | } 78 | 79 | var solver = new FishEulerSolver(); 80 | solver.Solve(new FishStructureProblem() { fish = model, dt = idt.DeltaTime }); 81 | 82 | // Debug.Log(idt.Current); 83 | // Debug.Log(idt.DeltaTime); 84 | 85 | sol.IsDone = idt.Current > activation.Interval.y; 86 | sol.logger.Log(model, idt.Current); 87 | return this.currentSolution; 88 | } 89 | protected void ApplyActivation(float t, FishBody body, MuscleMC mc) 90 | { 91 | var types = new List() { Spring.Type.MuscleFront, Spring.Type.MuscleMiddle, Spring.Type.MuscleBack }; 92 | foreach (var type in types) 93 | { 94 | mc.ActivationData.ApplyActivation(t, type, body.modelData, mc.GetParameter(type)); 95 | } 96 | 97 | } 98 | protected void ApplyActivation(float t, FishModelData modelData, FishActivationData data) 99 | { 100 | var types = new List() { Spring.Type.MuscleFront, Spring.Type.MuscleMiddle, Spring.Type.MuscleBack }; 101 | foreach (var type in types) 102 | { 103 | data.ApplyActivation(t, type, modelData); 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Assets/Scripts/Optimizer/FIshSimulatorOffline.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16ba7bc313d79cd4b9c23b7251d21ed5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Optimizer/FishControlOptimizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c779a7125f04c514a974d4d9fec3f306 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Optimizer/FishOfflineRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | using UnityTools.Algorithm; 6 | 7 | namespace UnityFishSimulation 8 | { 9 | public class FishOfflineRunner : MonoBehaviour 10 | { 11 | protected FishBody body; 12 | protected FishActivationData activationData; 13 | 14 | [SerializeField] protected float2 interval = new float2(0,20); 15 | [SerializeField] protected int sampleNum = 15; 16 | [SerializeField] protected List curves; 17 | [SerializeField] protected List activations; 18 | 19 | protected void Start() 20 | { 21 | this.body = this.GetComponent(); 22 | this.body.Init(); 23 | 24 | // this.activationData = new FishActivationDataSwimming(this.interval, this.sampleNum); 25 | //this.activationData.RandomActivation(); 26 | this.activationData = FishActivationData.Load(); 27 | this.interval = this.activationData.Interval; 28 | this.sampleNum = this.activationData.SampleNum; 29 | 30 | this.curves = this.activationData.ToAnimationCurves(); 31 | this.activations = this.activationData.ToActivationList(); 32 | 33 | var problem = new FishSimulatorOffline.Problem(this.body.modelData, this.activationData); 34 | var dt = new IterationDelta(); 35 | var sim = new FishSimulatorOffline(problem, dt); 36 | sim.TryToRun(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Assets/Scripts/Optimizer/FishOfflineRunner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce647a8f8d7c1404287bd0df81c88342 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestScript.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95f49271d561ceb4288acef89ecf3ee5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/TestScript/FinTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | public class FinTest : MonoBehaviour 7 | { 8 | public float3 worldUp = new float3(0, 1, 0); 9 | public float left = math.PI / 2; 10 | public float right = math.PI / 2; 11 | 12 | public float angle = math.PI/2; 13 | 14 | public float3 leftUpNormal; 15 | public float3 projection; 16 | // Start is called before the first frame update 17 | void Start() 18 | { 19 | 20 | } 21 | 22 | // Update is called once per frame 23 | void Update() 24 | { 25 | var left = new float3(this.transform.forward); 26 | var normal = new float3(this.transform.up); 27 | left = math.normalize(left); 28 | normal = math.normalize(normal); 29 | 30 | this.leftUpNormal = math.normalize(math.cross(this.worldUp, left)); 31 | this.projection = normal - (math.dot(normal, leftUpNormal) * leftUpNormal); 32 | this.projection = math.normalize(projection); 33 | var angleWithWorld = math.acos(math.dot(left, this.worldUp)); 34 | 35 | this.left = angleWithWorld; 36 | this.right = math.PI - angleWithWorld; 37 | 38 | this.angle = angleWithWorld; 39 | } 40 | 41 | 42 | void OnDrawGizmos() 43 | { 44 | Gizmos.color = Color.red; 45 | Gizmos.DrawLine(float3.zero, this.leftUpNormal * 10); 46 | Gizmos.color = Color.cyan; 47 | Gizmos.DrawLine(float3.zero, this.projection * 10); 48 | Gizmos.color = Color.green; 49 | Gizmos.DrawLine(float3.zero, this.worldUp * 10); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Scripts/TestScript/FinTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac1f64392330f0a40bc8e753bfaa681e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestScript/LeftRight.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | public class LeftRight : MonoBehaviour 7 | { 8 | public GameObject other; 9 | public float angle = 0; 10 | // Start is called before the first frame update 11 | void Start() 12 | { 13 | 14 | } 15 | 16 | // Update is called once per frame 17 | void Update() 18 | { 19 | var org = this.transform.position; 20 | var dir = this.transform.forward; 21 | 22 | var target = math.normalize(new float3(other.transform.position) - new float3(org)); 23 | this.angle = math.dot(target, dir); 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/Scripts/TestScript/LeftRight.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4d01b622fdd19d48831fad6700da043 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/StreamingAssets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b380e06ad03fe5d41aa56c77714975cf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/HandAdjust.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d714c7453ae739f44a448d21e22a306b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/HandAdjust/Swimming.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/HandAdjust/Swimming.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/HandAdjust/Swimming.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5a61105f2c087443afcae997ddd3af6 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/HandAdjust/TurnRight.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/HandAdjust/TurnRight.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/HandAdjust/TurnRight.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56e34db19a98c2448bf65b6f45996099 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/SAProblem.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/SAProblem.data -------------------------------------------------------------------------------- /Assets/StreamingAssets/SAProblem.data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83af5e8a7b2aded42aa8b8f17598cbe1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/Swimming - コピー.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/Swimming - コピー.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/Swimming - コピー.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83ee8f0d755d1c04e9de8dcc05d61113 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/Swimming.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/Swimming.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/Swimming.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b9e4dfd5d959c546b9ff8e28229b330 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/Turn.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/Turn.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/Turn.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a7e7a0ada0095442ac442ad47a77cc7 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/TurnLeft.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/TurnLeft.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/TurnLeft.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e448dde00ce14a74f94d4ed1c5d10b31 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/TurnRight.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/TurnRight.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/TurnRight.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 340a4407210309c4eb36c711641f7db1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d862219aa82fa0e4189ccf8ee7b197e3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/At.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1, , , , , , , , , , , , , , , , , , , 2 | ,1,1,1,1,1,1, ,1, , , , , , , , , , , , , , , 3 | , ,1,1,1,1,1,1, , , , , , , , , , , , , , , , 4 | , , ,1,1, ,1,1,1, , , , , , , , , , , , , , , 5 | , , , ,1,1, ,1,1, , , , , , , , , , , , , , , 6 | , , , , ,1,1,1,1,1,1, ,1, , , , , , , , , , , 7 | , , , , , ,1,1,1,1,1,1, , , , , , , , , , , , 8 | , , , , , , ,1,1, ,1,1,1, , , , , , , , , , , 9 | , , , , , , , ,1,1, ,1,1, , , , , , , , , , , 10 | , , , , , , , , ,1,1,1,1,1,1, ,1, , , , , , , 11 | , , , , , , , , , ,1,1,1,1,1,1, , , , , , , , 12 | , , , , , , , , , , ,1,1, ,1,1,1, , , , , , , 13 | , , , , , , , , , , , ,1,1, ,1,1, , , , , , , 14 | , , , , , , , , , , , , ,1,1,1,1,1,1, ,1, , , 15 | , , , , , , , , , , , , , ,1,1,1,1,1,1, , , , 16 | , , , , , , , , , , , , , , ,1,1, ,1,1,1, , , 17 | , , , , , , , , , , , , , , , ,1,1, ,1,1, , , 18 | , , , , , , , , , , , , , , , , ,1,1,1,1,1,1, 19 | , , , , , , , , , , , , , , , , , ,1,1,1,1,1, 20 | , , , , , , , , , , , , , , , , , , ,1,1,1,1, 21 | , , , , , , , , , , , , , , , , , , , ,1,1,1, 22 | , , , , , , , , , , , , , , , , , , , , ,1,1, 23 | , , , , , , , , , , , , , , , , , , , , , ,1, 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/At.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84fca3d89cb4dc44d9f9129c46ebf232 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/D.csv: -------------------------------------------------------------------------------- 1 | float3(20f, 20f, 20f), , , , , , , , , , , , , , , , , , , , , , , 2 | ,float3(120f, 120f, 120f), , , , , , , , , , , , , , , , , , , , , , 3 | , ,float3(120f, 120f, 120f), , , , , , , , , , , , , , , , , , , , , 4 | , , ,float3(120f, 120f, 120f), , , , , , , , , , , , , , , , , , , , 5 | , , , ,float3(120f, 120f, 120f), , , , , , , , , , , , , , , , , , , 6 | , , , , ,float3(198.5607f, 199.7601f, 200f), , , , , , , , , , , , , , , , , , 7 | , , , , , ,float3(192.3272f, 198.7212f, 200f), , , , , , , , , , , , , , , , , 8 | , , , , , , ,float3(192.3272f, 201.2788f, 200f), , , , , , , , , , , , , , , , 9 | , , , , , , , ,float3(198.5607f, 200.2399f, 200f), , , , , , , , , , , , , , , 10 | , , , , , , , , ,float3(107.3093f, 118.187f, 118.187f), , , , , , , , , , , , , , 11 | , , , , , , , , , ,float3(117.8076f, 119.6868f, 120.3132f), , , , , , , , , , , , , 12 | , , , , , , , , , , ,float3(117.8076f, 120.3132f, 120.3132f), , , , , , , , , , , , 13 | , , , , , , , , , , , ,float3(107.3093f, 121.813f, 117.2806f), , , , , , , , , , , 14 | , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , , , , , , , 15 | , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , , , , , , 16 | , , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , , , , , 17 | , , , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , , , , 18 | , , , , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , , , 19 | , , , , , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , , 20 | , , , , , , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , , 21 | , , , , , , , , , , , , , , , , , , , ,float3(20f, 20f, 20f), , , 22 | , , , , , , , , , , , , , , , , , , , , ,float3(3f, 3f, 3f), , 23 | , , , , , , , , , , , , , , , , , , , , , ,float3(3f, 3f, 3f), 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/D.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a03a0ea3c8ec0094699f301030094dac 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/DSSwimming.func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/DSSwimming.func -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/DSSwimming.func.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c089c9ed0e933f488e6ade16b449584 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/L.csv: -------------------------------------------------------------------------------- 1 | , , , , , , , , , , , , , , , , , , , , , , , 2 | , , , , , , , , , , , , , , , , , , , , , , , 3 | , , , , , , , , , , , , , , , , , , , , , , , 4 | , , , , , , , , , , , , , , , , , , , , , , , 5 | , , , , , , , , , , , , , , , , , , , , , , , 6 | , , , , , , , , , , , , , , , , , , , , , , , 7 | , , , , , , , , , , , , , , , , , , , , , , , 8 | , , , , , , , , , , , , , , , , , , , , , , , 9 | , , , , , , , , , , , , , , , , , , , , , , , 10 | , , , , ,float3(0.7196485f, 0.1199414f, 0f), , , , , , , , , , , , , , , , , , 11 | , , , , , ,float3(3.836404f, 0.6394008f, 0f), , , , , , , , , , , , , , , , , 12 | , , , , , , ,float3(3.836404f, -0.6394008f, 0f), , , , , , , , , , , , , , , , 13 | , , , , , , , ,float3(0.7196485f, -0.1199414f, 0f), , , , , , , , , , , , , , , 14 | , , , , , , , , ,float3(6.345343f, 0.9064776f, 0.9064776f), , , , , , , , , , , , , , 15 | , , , , , , , , , ,float3(1.09621f, 0.1566014f, -0.1566014f), , , , , , , , , , , , , 16 | , , , , , , , , , , ,float3(1.09621f, -0.1566014f, -0.1566014f), , , , , , , , , , , , 17 | , , , , , , , , , , , ,float3(6.345344f, -0.9064777f, 1.359717f), , , , , , , , , , , 18 | , , , , , , , , , , , , , , , , , , , , , , , 19 | , , , , , , , , , , , , , , , , , , , , , , , 20 | , , , , , , , , , , , , , , , , , , , , , , , 21 | , , , , , , , , , , , , , , , , , , , , , , , 22 | , , , , , , , , , , , , , , , , , , , , , , , 23 | , , , , , , , , , , , , , , , , , , , , , , , 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/L.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: abaf02d0b26e2f144aa07bc3cc01d422 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/LT.csv: -------------------------------------------------------------------------------- 1 | , , , , , , , , , , , , , , , , , , , , , , , 2 | , , , , , , , , , , , , , , , , , , , , , , , 3 | , , , , , , , , , , , , , , , , , , , , , , , 4 | , , , , , , , , , , , , , , , , , , , , , , , 5 | , , , , , , , , , , , , , , , , , , , , , , , 6 | , , , , , , , , ,float3(0.7196485f, 0.1199414f, 0f), , , , , , , , , , , , , , 7 | , , , , , , , , , ,float3(3.836404f, 0.6394008f, 0f), , , , , , , , , , , , , 8 | , , , , , , , , , , ,float3(3.836404f, -0.6394008f, 0f), , , , , , , , , , , , 9 | , , , , , , , , , , , ,float3(0.7196485f, -0.1199414f, 0f), , , , , , , , , , , 10 | , , , , , , , , , , , , ,float3(6.345343f, 0.9064776f, 0.9064776f), , , , , , , , , , 11 | , , , , , , , , , , , , , ,float3(1.09621f, 0.1566014f, -0.1566014f), , , , , , , , , 12 | , , , , , , , , , , , , , , ,float3(1.09621f, -0.1566014f, -0.1566014f), , , , , , , , 13 | , , , , , , , , , , , , , , , ,float3(6.345344f, -0.9064777f, 1.359717f), , , , , , , 14 | , , , , , , , , , , , , , , , , , , , , , , , 15 | , , , , , , , , , , , , , , , , , , , , , , , 16 | , , , , , , , , , , , , , , , , , , , , , , , 17 | , , , , , , , , , , , , , , , , , , , , , , , 18 | , , , , , , , , , , , , , , , , , , , , , , , 19 | , , , , , , , , , , , , , , , , , , , , , , , 20 | , , , , , , , , , , , , , , , , , , , , , , , 21 | , , , , , , , , , , , , , , , , , , , , , , , 22 | , , , , , , , , , , , , , , , , , , , , , , , 23 | , , , , , , , , , , , , , , , , , , , , , , , 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/LT.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4255922ecd1e71a44b8da0053055cc15 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Q.csv: -------------------------------------------------------------------------------- 1 | float3(-6.330806E-05f, 3.041185E-10f, 8.322481E-07f), 2 | float3(-0.002930097f, -0.0003004004f, -0.000675872f), 3 | float3(-0.002914735f, -0.0002801875f, 0.0006957567f), 4 | float3(-0.002908437f, 0.000285353f, 0.0006938158f), 5 | float3(-0.002922035f, 0.0003050133f, -0.000673178f), 6 | float3(-0.3547149f, -0.05848391f, 0.001348228f), 7 | float3(-0.05122864f, -0.00775766f, -0.0009913177f), 8 | float3(-0.04909887f, 0.007807952f, -0.001833357f), 9 | float3(-0.3524895f, 0.05790677f, 0.002016229f), 10 | float3(0.6687908f, 0.09827882f, 0.03947156f), 11 | float3(-0.5180737f, -0.006799828f, -0.009431328f), 12 | float3(-0.4575449f, 0.008240047f, 0.01158269f), 13 | float3(0.7373905f, -0.1577458f, 0.06875648f), 14 | float3(-3.340498f, -0.8290138f, -0.6026807f), 15 | float3(3.196392f, 1.161133f, -0.5820588f), 16 | float3(3.498916f, -0.7043043f, -0.5437617f), 17 | float3(-3.433017f, 1.15657f, -0.8981846f), 18 | float3(0.09231362f, -0.1009569f, 0.04571792f), 19 | float3(0.1384169f, 0.05016254f, 0.1430743f), 20 | float3(-0.2188191f, -0.1337665f, 0.8892107f), 21 | float3(-0.2813643f, 0.05991316f, 0.5322529f), 22 | float3(-0.9565325f, -0.3303755f, 0.01037777f), 23 | float3(1.622474f, 0.6647054f, -0.03149646f), 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Q.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f0aff1d7925db3439b5d3b9ca8ac730 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Q_1.csv: -------------------------------------------------------------------------------- 1 | float3(-3.165402E-06f, 1.520592E-11f, 4.161239E-08f), 2 | float3(-2.441692E-05f, -2.50328E-06f, -5.63214E-06f), 3 | float3(-2.428891E-05f, -2.334843E-06f, 5.797842E-06f), 4 | float3(-2.423643E-05f, 2.377888E-06f, 5.781668E-06f), 5 | float3(-2.434974E-05f, 2.54172E-06f, -5.60969E-06f), 6 | float3(-0.001767758f, -0.0002914606f, 6.719036E-06f), 7 | float3(-0.0002560162f, -3.876907E-05f, -4.95413E-06f), 8 | float3(-0.0002453773f, 3.902114E-05f, -9.162413E-06f), 9 | float3(-0.001756696f, 0.0002885889f, 1.004824E-05f), 10 | float3(0.005545772f, 0.0008149512f, 0.0003273075f), 11 | float3(-0.00429157f, -5.632776E-05f, -7.812633E-05f), 12 | float3(-0.003791418f, 6.828066E-05f, 9.597927E-05f), 13 | float3(0.006118763f, -0.001308953f, 0.0005705316f), 14 | float3(-0.1686038f, -0.04184252f, -0.03041889f), 15 | float3(0.1566951f, 0.05692163f, -0.02853398f), 16 | float3(0.1686356f, -0.03394501f, -0.02620742f), 17 | float3(-0.1767994f, 0.059563f, -0.04625625f), 18 | float3(0.004853943f, -0.005308419f, 0.002403895f), 19 | float3(0.007179048f, 0.002601701f, 0.007420612f), 20 | float3(-0.01164301f, -0.007117499f, 0.04731346f), 21 | float3(-0.01451933f, 0.003091717f, 0.02746601f), 22 | float3(0.002688075f, 0.0009284308f, -2.916392E-05f), 23 | float3(-0.004560422f, -0.001868342f, 8.852968E-05f), 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Q_1.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bc974244e15c5b4783155ed6e23f1b0 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblem.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/SAProblem.data -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblem.data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b99128943060d9e49b7c4a3d4d84b716 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblemEndSpeed.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/SAProblemEndSpeed.data -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblemEndSpeed.data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fad3dec6f13a6d4bbf6cdbdda1f3a3f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblemNoSim.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/SAProblemNoSim.data -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblemNoSim.data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 344e80e996c6bf142a60ba9d0de5efde 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblemTurn.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/SAProblemTurn.data -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/SAProblemTurn.data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3be93efab109ca458af459df0172047 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming - コピー (2).ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimming - コピー (2).ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming - コピー (2).ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43353a2441bc79546bc9a493e7c7a50e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming - コピー.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimming - コピー.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming - コピー.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1fa2764cf1f7e342a56a28dbd549428 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming.func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimming.func -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming.func.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9c4cf908fcab7149a64d4afa1170b14 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming.mc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimming.mc -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming.mc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6cb5e95109c6256458bfa500be23de2e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming2.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimming2.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimming2.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ad088e0259a41a488d866540107c5c3 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimmingb1.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimmingb1.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimmingb1.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d251d0e0da2c5f428c713d87147c1c8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimmingb2.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/Swimmingb2.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/Swimmingb2.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22c2d837a028b0347b293b617f076a33 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/X_Velocity.csv: -------------------------------------------------------------------------------- 1 | float3(-1.582701E-07f, 7.602957E-13f, 2.080619E-09f), 2 | float3(-2.034697E-07f, -2.08602E-08f, -4.693343E-08f), 3 | float3(-2.02403E-07f, -1.945659E-08f, 4.831426E-08f), 4 | float3(-2.019657E-07f, 1.981529E-08f, 4.817948E-08f), 5 | float3(-2.029099E-07f, 2.118052E-08f, -4.674636E-08f), 6 | float3(-8.809807E-06f, -1.452524E-06f, 3.348501E-08f), 7 | float3(-1.279446E-06f, -1.937492E-07f, -2.475837E-08f), 8 | float3(-1.226301E-06f, 1.950126E-07f, -4.579022E-08f), 9 | float3(-8.754812E-06f, 1.438235E-06f, 5.007724E-08f), 10 | float3(4.598685E-05f, 6.757768E-06f, 2.714111E-06f), 11 | float3(-3.55501E-05f, -4.666025E-07f, -6.471754E-07f), 12 | float3(-3.141737E-05f, 5.658037E-07f, 7.953265E-07f), 13 | float3(5.077264E-05f, -1.08615E-05f, 4.734192E-06f), 14 | float3(-0.008509879f, -0.002111902f, -0.001535322f), 15 | float3(0.007681588f, 0.002790441f, -0.001398807f), 16 | float3(0.008127647f, -0.001636031f, -0.001263106f), 17 | float3(-0.009105118f, 0.003067478f, -0.002382183f), 18 | float3(0.0002552253f, -0.000279122f, 0.0001263992f), 19 | float3(0.0003723444f, 0.0001349383f, 0.0003848732f), 20 | float3(-0.0006195055f, -0.0003787105f, 0.002517472f), 21 | float3(-0.0007492453f, 0.0001595428f, 0.001417337f), 22 | float3(-7.554107E-06f, -2.609103E-06f, 8.195728E-08f), 23 | float3(1.281835E-05f, 5.251503E-06f, -2.488377E-07f), 24 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/X_Velocity.csv.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74b5bb049a33b2b4ab2f32179bfd4a89 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/fish - コピー.model: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/fish - コピー.model -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/fish - コピー.model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb3d84c471a9e384b9fd968866fe1da8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/fish.graph: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/fish.graph -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/fish.graph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c73cb83b7538a5a4d933190acd7d3ecd 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s15.func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/s15.func -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s15.func.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaa1fc50c16214844b92718f79681e5a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s30 - コピー.func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/s30 - コピー.func -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s30 - コピー.func.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f79d9750fd83e84eaa7e442601f7d9a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s30.func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/s30.func -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s30.func.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d33d613e46e96914a826d0c2115444e1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s301.func: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/archive/s301.func -------------------------------------------------------------------------------- /Assets/StreamingAssets/archive/s301.func.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9b48625238d40c4495b90c91a4bd207 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d937077543f689f47ab8687850094f26 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup/Swimming.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/backup/Swimming.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup/Swimming.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 102e5ce75e073d7488df6e53efa7bf94 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup/Swimmingorg.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/backup/Swimmingorg.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup/Swimmingorg.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1949ca3aacc2a2c40a310c3279bdd043 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup/TurnRightb1.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/backup/TurnRightb1.ad -------------------------------------------------------------------------------- /Assets/StreamingAssets/backup/TurnRightb1.ad.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 654569c6fd04bce4ebd90965ade8e803 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/fish.model: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/fish.model -------------------------------------------------------------------------------- /Assets/StreamingAssets/fish.model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a3473d87c8831447a04ebaebc49b552 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/jellyfish.model: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/Assets/StreamingAssets/jellyfish.model -------------------------------------------------------------------------------- /Assets/StreamingAssets/jellyfish.model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a32ecd12741cbc4893bd5b911ea1722 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.2.16", 4 | "com.unity.ide.rider": "1.1.4", 5 | "com.unity.ide.vscode": "1.2.0", 6 | "com.unity.mathematics": "1.1.0", 7 | "com.unity.test-framework": "1.1.14", 8 | "com.unity.textmeshpro": "2.0.1", 9 | "com.unity.timeline": "1.2.14", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 43 | type: 0} 44 | m_CustomRenderPipeline: {fileID: 0} 45 | m_TransparencySortMode: 0 46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 47 | m_DefaultRenderingPath: 1 48 | m_DefaultMobileRenderingPath: 1 49 | m_TierSettings: [] 50 | m_LightmapStripping: 0 51 | m_FogStripping: 0 52 | m_InstancingStripping: 0 53 | m_LightmapKeepPlain: 1 54 | m_LightmapKeepDirCombined: 1 55 | m_LightmapKeepDynamicPlain: 1 56 | m_LightmapKeepDynamicDirCombined: 1 57 | m_LightmapKeepShadowMask: 1 58 | m_LightmapKeepSubtractive: 1 59 | m_FogKeepLinear: 1 60 | m_FogKeepExp: 1 61 | m_FogKeepExp2: 1 62 | m_AlbedoSwatchInfos: [] 63 | m_LightsUseLinearIntensity: 0 64 | m_LightsUseColorTemperature: 0 65 | m_LogWhenShaderIsCompiled: 0 66 | m_AllowEnlightenSupportForUpgradedProject: 0 67 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.3.14f1 2 | m_EditorVersionWithRevision: 2019.3.14f1 (2b330bf6d2d8) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Stadia: 5 227 | Standalone: 5 228 | WebGL: 3 229 | Windows Store Apps: 5 230 | XboxOne: 5 231 | iPhone: 2 232 | tvOS: 2 233 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnityFishSimulation 2 | 3 | This is an implementation of Artificial Fishes: Autonomous Locomotion, Perception, Behavior, and Learning in a Simulated Physical World. 4 | 5 | Include 6 | 7 | - Fish Structure with mass-spring-damper system 8 | - Optimizer for motion control functions: 9 | - Downhill Simplex 10 | - Simulated Annealing 11 | - Fish brain implementation 12 | 13 | ![](gif/swim.gif) 14 | 15 | ![](gif/food.gif) 16 | 17 | ![](gif/overview.gif) -------------------------------------------------------------------------------- /gif/food.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/gif/food.gif -------------------------------------------------------------------------------- /gif/overview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/gif/overview.gif -------------------------------------------------------------------------------- /gif/swim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanish87/UnityFishSimulation/af7bdde2dc56615092450ec709bbcc0955c5ba75/gif/swim.gif --------------------------------------------------------------------------------