修改水

This commit is contained in:
2026-01-01 22:00:33 +08:00
parent 040a222bd6
commit 9ceffccd39
1800 changed files with 103929 additions and 139495 deletions

View File

@@ -1,213 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FanHorizontal
serializedVersion: 7
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: -0.25, y: 0, z: 2}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 4
value: {x: -0.25, y: 0, z: -5}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 8.016666
value: {x: -0.25, y: 0, z: 2}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path:
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 1
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 8.016666
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: -0.25
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 4
value: -0.25
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 8.016666
value: -0.25
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.x
path:
classID: 4
script: {fileID: 0}
flags: 16
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 4
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 8.016666
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.y
path:
classID: 4
script: {fileID: 0}
flags: 16
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 2
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 4
value: -5
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 8.016666
value: 2
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.z
path:
classID: 4
script: {fileID: 0}
flags: 16
m_EulerEditorCurves: []
m_HasGenericRootTransform: 1
m_HasMotionFloatCurves: 0
m_Events: []

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8e33f749f1d024f159aa5cae7a502d72
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,72 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1107 &-2774476986902412069
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -1105214364667259717}
m_Position: {x: 250, y: 120, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -1105214364667259717}
--- !u!1102 &-1105214364667259717
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FanHorizontal
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 8e33f749f1d024f159aa5cae7a502d72, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FanRoot
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -2774476986902412069}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 07415f30e4149416b920c1da07bdc3b7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -918,13 +918,13 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 110298501}
m_Position: {x: 470, y: 20, z: 0}
m_Position: {x: 590, y: 100, z: 0}
- serializedVersion: 1
m_State: {fileID: 110200000}
m_Position: {x: 670, y: -100, z: 0}
m_Position: {x: 440, y: 240, z: 0}
- serializedVersion: 1
m_State: {fileID: 110276412}
m_Position: {x: 370, y: -120, z: 0}
m_Position: {x: 440, y: -50, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []

View File

@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5b9c84cdb747944209b1c8753933c5db, type: 3}
m_Name: HighFriction
m_EditorClassIdentifier:
dynamicFriction: 0.5
dynamicFriction: 1
staticFriction: 0
stickiness: 0
stickDistance: 0

View File

@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5b9c84cdb747944209b1c8753933c5db, type: 3}
m_Name: MediumFriction
m_EditorClassIdentifier:
dynamicFriction: 0.1
dynamicFriction: 0.17
staticFriction: 0
stickiness: 0
stickDistance: 0

View File

@@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5b9c84cdb747944209b1c8753933c5db, type: 3}
m_Name: RollingFriction
m_EditorClassIdentifier:
dynamicFriction: 0.9
dynamicFriction: 0.7
staticFriction: 0
stickiness: 0
stickDistance: 0
frictionCombine: 0
stickinessCombine: 1
stickinessCombine: 3
rollingContacts: 1
rollingFriction: 0.02
rollingFriction: 0.2

View File

@@ -1,22 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5b9c84cdb747944209b1c8753933c5db, type: 3}
m_Name: RollingFrictionSmoke
m_EditorClassIdentifier:
dynamicFriction: 0.1
staticFriction: 0
stickiness: 0
stickDistance: 0
frictionCombine: 0
stickinessCombine: 3
rollingContacts: 1
rollingFriction: 0.01

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bb309543303c94a32b84f20d84389f76
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -12,10 +12,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5b9c84cdb747944209b1c8753933c5db, type: 3}
m_Name: VerySticky
m_EditorClassIdentifier:
dynamicFriction: 0.3
dynamicFriction: 0.2
staticFriction: 0
stickiness: 0.16
stickDistance: 0.025
stickiness: 0.2
stickDistance: 0.03
frictionCombine: 3
stickinessCombine: 3
rollingContacts: 0

View File

@@ -1,18 +1,5 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6423271243515826522
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
--- !u!21 &2100000
Material:
serializedVersion: 8
@@ -37,12 +24,8 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 8fbd9c5f957b8434883cdfce9d6a3c27, type: 3}
m_Scale: {x: 5, y: 5}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 176574918b29445148929eb9a46c70ef, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
@@ -59,11 +42,11 @@ Material:
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 5, y: 5}
m_Scale: {x: 40, y: 40}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8fbd9c5f957b8434883cdfce9d6a3c27, type: 3}
m_Scale: {x: 5, y: 5}
m_Scale: {x: 40, y: 40}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
@@ -77,36 +60,13 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 1
- _Glossiness: 0.3
- _GlossyReflections: 1
@@ -114,21 +74,14 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _UVSec: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -67,28 +67,13 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 0
@@ -102,7 +87,6 @@ Material:
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueOffset: 0
- _RadiusScale: 1
- _ReceiveShadows: 1
- _SampleGI: 0
- _Shininess: 0
@@ -136,4 +120,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
version: 2

View File

@@ -68,7 +68,7 @@ Material:
- _DstBlend: 0
- _EmissionScaleUI: 0
- _GlossMapScale: 1
- _Glossiness: 0.7
- _Glossiness: 0.6
- _GlossyReflections: 1
- _Metallic: 1
- _Mode: 0
@@ -80,7 +80,7 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.6, g: 0.6, b: 0.6, a: 1}
- _Color: {r: 0.4705882, g: 0.4705882, b: 0.4705882, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@@ -1,171 +0,0 @@
fileFormatVersion: 2
guid: 89e24673c05344d179c516868eb341b8
ModelImporter:
serializedVersion: 21202
internalIDToNameTable:
- first:
1: 100000
second: //RootNode
- first:
1: 100002
second: pCube2
- first:
1: 100004
second: pCube3
- first:
1: 100006
second: pCube4
- first:
1: 100008
second: pCylinder1
- first:
4: 400000
second: //RootNode
- first:
4: 400002
second: pCube2
- first:
4: 400004
second: pCube3
- first:
4: 400006
second: pCube4
- first:
4: 400008
second: pCylinder1
- first:
23: 2300000
second: pCube2
- first:
23: 2300002
second: pCube3
- first:
23: 2300004
second: pCube4
- first:
23: 2300006
second: pCylinder1
- first:
33: 3300000
second: pCube2
- first:
33: 3300002
second: pCube3
- first:
33: 3300004
second: pCube4
- first:
33: 3300006
second: pCylinder1
- first:
43: 4300000
second: pCylinder1
- first:
43: 4300002
second: pCube2
- first:
43: 4300004
second: pCube3
- first:
43: 4300006
second: pCube4
externalObjects: {}
materials:
materialImportMode: 0
materialName: 0
materialSearch: 1
materialLocation: 0
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 40
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 1
importCameras: 0
importLights: 0
nodeNameCollisionStrategy: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 0
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 1
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 40
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 0
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 64df75de10b494f109b074d28a8eade0
ModelImporter:
serializedVersion: 21202
serializedVersion: 26
internalIDToNameTable:
- first:
1: 100000
@@ -20,7 +20,7 @@ ModelImporter:
second: pCube1
externalObjects: {}
materials:
materialImportMode: 0
importMaterials: 0
materialName: 0
materialSearch: 1
materialLocation: 0
@@ -29,7 +29,6 @@ ModelImporter:
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
@@ -59,27 +58,20 @@ ModelImporter:
importBlendShapes: 1
importCameras: 0
importLights: 0
nodeNameCollisionStrategy: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 0
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
@@ -92,6 +84,7 @@ ModelImporter:
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 3
human: []
@@ -109,11 +102,8 @@ ModelImporter:
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 0
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 0
additionalBone: 0
userData:
assetBundleName:

View File

@@ -1,69 +0,0 @@
using UnityEngine;
using UnityEngine.Events;
namespace Obi.Samples
{
[RequireComponent(typeof(ObiSolver))]
public class ActorActorCollisionDetector : MonoBehaviour
{
public struct ActorPair
{
public readonly ObiActor actorA;
public readonly ObiActor actorB;
public int particleA;
public int particleB;
public ActorPair(ObiActor actorA, ObiActor actorB, int particleA, int particleB)
{
this.actorA = actorA;
this.actorB = actorB;
this.particleA = particleA;
this.particleB = particleB;
}
}
public UnityEvent<ActorPair> callback;
ObiSolver solver;
void OnEnable()
{
solver = GetComponent<Obi.ObiSolver>();
solver.OnParticleCollision += Solver_OnCollision;
}
void OnDisable()
{
solver.OnParticleCollision -= Solver_OnCollision;
}
void Solver_OnCollision(object sender, ObiNativeContactList e)
{
if (!solver.initialized || callback == null) return;
// just iterate over all contacts in the current frame:
foreach (Oni.Contact contact in e)
{
// if this one is an actual collision:
if (contact.distance < 0.01)
{
// get the index of the first entry in the simplices array for both bodies:
int startA = solver.simplexCounts.GetSimplexStartAndSize(contact.bodyA, out _);
int startB = solver.simplexCounts.GetSimplexStartAndSize(contact.bodyB, out _);
// retrieve the index of both particles from the simplices array:
int particleA = solver.simplices[startA];
int particleB = solver.simplices[startB];
// retrieve info about both actors involved in the collision:
var particleInActorA = solver.particleToActor[particleA];
var particleInActorB = solver.particleToActor[particleB];
// if they're not the same actor, trigger a callback:
if (particleInActorA != null && particleInActorB != null && particleInActorA.actor != particleInActorB.actor)
callback.Invoke(new ActorPair(particleInActorA.actor, particleInActorB.actor, particleA, particleB));
}
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a5a3cc3afb7a14486848b022c300ea32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,32 +0,0 @@
using UnityEngine;
using Obi;
namespace Obi.Samples
{
[RequireComponent(typeof(ObiActor))]
public class ActorBlinker : MonoBehaviour
{
public Color neutralColor = Color.white;
public Color highlightColor = Color.red;
private ObiActor actor;
void Awake()
{
actor = GetComponent<ObiActor>();
}
public void Blink(int particleIndex)
{
if (actor.solver != null)
actor.solver.colors[particleIndex] = highlightColor;
}
void LateUpdate()
{
if (actor.solver != null)
for (int i = 0; i < actor.activeParticleCount; ++i)
actor.solver.colors[actor.solverIndices[i]] += (neutralColor - actor.solver.colors[actor.solverIndices[i]]) * Time.deltaTime * 5;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fbbc507232dcc4cb1ae27d9474ddbe70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,23 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
public class ActorCOMTransform : MonoBehaviour
{
public class ActorCOMTransform : MonoBehaviour
public Vector3 offset;
public ObiActor actor;
public void Update()
{
public Vector3 offset;
public ObiActor actor;
public void Update()
if (actor != null && actor.isLoaded)
{
if (actor != null && actor.isLoaded)
{
Vector3 com;
actor.GetMass(out com);
transform.position = actor.solver.transform.TransformPoint(com) + offset;
}
Vector3 com;
actor.GetMass(out com);
transform.position = actor.solver.transform.TransformPoint(com) + offset;
}
}
}

View File

@@ -1,33 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
{
public class ActorSpawner : MonoBehaviour
{
public class ActorSpawner : MonoBehaviour {
public ObiActor template;
public ObiActor template;
public int maxInstances = 32;
public float spawnDelay = 0.3f;
public int basePhase = 2;
public int maxInstances = 32;
public float spawnDelay = 0.3f;
private int instances = 0;
private float timeFromLastSpawn = 0;
private int phase = 0;
private int instances = 0;
private float timeFromLastSpawn = 0;
// Update is called once per frame
void Update () {
// Update is called once per frame
void Update()
{
timeFromLastSpawn += Time.deltaTime;
timeFromLastSpawn += Time.deltaTime;
if (Input.GetMouseButtonDown(0) && instances < maxInstances && timeFromLastSpawn > spawnDelay)
{
GameObject go = Instantiate(template.gameObject,transform.position,Quaternion.identity);
go.transform.SetParent(transform.parent);
if (Input.GetMouseButtonDown(0) && instances < maxInstances && timeFromLastSpawn > spawnDelay)
{
GameObject go = Instantiate(template.gameObject, transform.position, Quaternion.identity);
go.transform.SetParent(transform.parent);
instances++;
timeFromLastSpawn = 0;
}
}
}
}
go.GetComponent<ObiActor>().SetFilterCategory(basePhase + phase);
phase++;
instances++;
timeFromLastSpawn = 0;
}
}
}

View File

@@ -1,21 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
{
[RequireComponent(typeof(ObiActor))]
public class AddRandomVelocity : MonoBehaviour
{
[RequireComponent(typeof(ObiActor))]
public class AddRandomVelocity : MonoBehaviour {
public float intensity = 5;
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
GetComponent<ObiActor>().AddForce(UnityEngine.Random.onUnitSphere * intensity, ForceMode.VelocityChange);
}
}
}
public float intensity = 5;
void Update () {
if (Input.GetKeyDown(KeyCode.Space)){
GetComponent<ObiActor>().AddForce(UnityEngine.Random.onUnitSphere*intensity,ForceMode.VelocityChange);
}
}
}

View File

@@ -1,30 +1,23 @@
using UnityEngine;
namespace Obi.Samples
{
public class Blinker : MonoBehaviour
{
public class Blinker : MonoBehaviour {
public Color highlightColor;
public Color highlightColor;
private Renderer rend;
private Color original;
private Renderer rend;
private Color original;
void Awake()
{
rend = GetComponent<Renderer>();
original = rend.material.color;
}
void Awake(){
rend = GetComponent<Renderer>();
original = rend.material.color;
}
public void Blink()
{
rend.material.color = highlightColor;
}
public void Blink(){
rend.material.color = highlightColor;
}
void LateUpdate()
{
rend.material.color += (original - rend.material.color) * Time.deltaTime * 5;
}
void LateUpdate(){
rend.material.color += (original - rend.material.color)*Time.deltaTime*5;
}
}
}
}

View File

@@ -33,7 +33,7 @@ namespace Obi{
}
private void Update()
private void FixedUpdate()
{
if (!m_Jump)
{

View File

@@ -1,51 +1,48 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Obi;
namespace Obi.Samples
{
[RequireComponent(typeof(ObiSolver))]
public class ColliderHighlighter : MonoBehaviour
{
[RequireComponent(typeof(ObiSolver))]
public class ColliderHighlighter : MonoBehaviour {
ObiSolver solver;
ObiSolver solver;
void Awake()
{
solver = GetComponent<Obi.ObiSolver>();
}
void Awake(){
solver = GetComponent<Obi.ObiSolver>();
}
void OnEnable()
{
solver.OnCollision += Solver_OnCollision;
}
void OnEnable () {
solver.OnCollision += Solver_OnCollision;
}
void OnDisable()
{
solver.OnCollision -= Solver_OnCollision;
}
void OnDisable(){
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision (object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
var colliderWorld = ObiColliderWorld.GetInstance();
void Solver_OnCollision(object sender, ObiNativeContactList e)
{
var colliderWorld = ObiColliderWorld.GetInstance();
Oni.Contact[] contacts = e.contacts.Data;
for(int i = 0; i < e.contacts.Count; ++i)
{
Oni.Contact c = contacts[i];
// make sure this is an actual contact:
if (c.distance < 0.01f)
{
// get the collider:
var col = colliderWorld.colliderHandles[c.bodyB].owner;
for (int i = 0; i < e.count; ++i)
{
Oni.Contact c = e[i];
// make sure this is an actual contact:
if (c.distance < 0.01f)
if (col != null)
{
// get the collider:
var col = colliderWorld.colliderHandles[c.bodyB].owner;
if (col != null)
{
// make it blink:
Blinker blinker = col.GetComponent<Blinker>();
if (blinker)
blinker.Blink();
}
}
}
}
}
// make it blink:
Blinker blinker = col.GetComponent<Blinker>();
if (blinker)
blinker.Blink();
}
}
}
}
}

View File

@@ -1,97 +1,184 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Obi;
namespace Obi.Samples
[RequireComponent(typeof(ObiSolver))]
public class CollisionEventHandler : MonoBehaviour
{
[RequireComponent(typeof(ObiSolver))]
public class CollisionEventHandler : MonoBehaviour
ObiSolver solver;
public int contactCount;
Obi.ObiSolver.ObiCollisionEventArgs frame;
void Awake()
{
solver = GetComponent<Obi.ObiSolver>();
}
ObiSolver solver;
public int contactCount;
void OnEnable()
{
solver.OnParticleCollision += Solver_OnCollision;
}
ObiNativeContactList frame;
void OnDisable()
{
solver.OnParticleCollision -= Solver_OnCollision;
}
void Awake()
void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
frame = e;
}
void OnDrawGizmos()
{
if (solver == null || frame == null || frame.contacts == null) return;
Gizmos.matrix = solver.transform.localToWorldMatrix;
contactCount = frame.contacts.Count;
/*for (int i = 0; i < frame.contacts.Count; ++i)
{
solver = GetComponent<Obi.ObiSolver>();
}
var contact = frame.contacts.Data[i];
void OnEnable()
//if (contact.distance > 0.001f) continue;
Gizmos.color = (contact.distance <= 0) ? Color.red : Color.green;
//Gizmos.color = new Color(((i * 100) % 255) / 255.0f, ((i * 50) % 255) / 255.0f, ((i * 20) % 255) / 255.0f);
Vector3 point = frame.contacts.Data[i].pointB;
Gizmos.DrawSphere(point, 0.01f);
Gizmos.DrawRay(point, contact.normal * contact.distance);
Gizmos.color = Color.cyan;
Gizmos.DrawRay(point, contact.tangent * contact.tangentImpulse + contact.bitangent * contact.bitangentImpulse);
}*/
for (int i = 0; i < frame.contacts.Count; ++i)
{
solver.OnCollision += Solver_OnCollision;
}
var contact = frame.contacts.Data[i];
void OnDisable()
{
solver.OnCollision -= Solver_OnCollision;
}
//if (contact.distance > 0.001f) continue;
void Solver_OnCollision(object sender, ObiNativeContactList e)
{
frame = e;
}
Gizmos.color = (contact.distance <= 0) ? Color.red : Color.green;
void OnDrawGizmos()
{
if (solver == null || frame == null) return;
//Gizmos.color = new Color(((i * 100) % 255) / 255.0f, ((i * 50) % 255) / 255.0f, ((i * 20) % 255) / 255.0f);
Gizmos.matrix = solver.transform.localToWorldMatrix;
Vector3 point = Vector3.zero;//frame.contacts.Data[i].point;
contactCount = frame.count;
int simplexStart = solver.simplexCounts.GetSimplexStartAndSize(contact.bodyB, out int simplexSize);
for (int i = 0; i < frame.count; ++i)
float radius = 0;
for (int j = 0; j < simplexSize; ++j)
{
var contact = frame[i];
//if (contact.distance > 0.001f) continue;
Gizmos.color = (contact.distance <= 0) ? Color.red : Color.green;
//Gizmos.color = new Color(((i * 100) % 255) / 255.0f, ((i * 50) % 255) / 255.0f, ((i * 20) % 255) / 255.0f);
Vector3 point = frame[i].pointB;
Gizmos.DrawSphere(point, 0.01f);
Gizmos.DrawRay(point, contact.normal * contact.distance);
Gizmos.color = Color.cyan;
//Gizmos.DrawRay(point, contact.tangent * contact.tangentImpulse + contact.bitangent * contact.bitangentImpulse);
point += (Vector3)solver.positions[solver.simplices[simplexStart + j]] * contact.pointB[j];
radius += solver.principalRadii[solver.simplices[simplexStart + j]].x * contact.pointB[j];
}
/*for (int i = 0; i < frame.count; ++i)
{
var contact = frame[i];
Vector3 normal = contact.normal;
//if (contact.distance > 0.001f) continue;
//Gizmos.DrawSphere(point + normal.normalized * frame.contacts[i].distance, 0.01f);
Gizmos.color = (contact.distance <= 0) ? Color.red : Color.green;
Gizmos.DrawSphere(point + normal * radius, 0.01f);
//Gizmos.color = new Color(((i * 100) % 255) / 255.0f, ((i * 50) % 255) / 255.0f, ((i * 20) % 255) / 255.0f);
Vector3 point = Vector3.zero;//frame.contacts.Data[i].point;
int simplexStart = solver.simplexCounts.GetSimplexStartAndSize(contact.bodyB, out int simplexSize);
float radius = 0;
for (int j = 0; j < simplexSize; ++j)
{
point += (Vector3)solver.positions[solver.simplices[simplexStart + j]] * contact.pointB[j];
radius += solver.principalRadii[solver.simplices[simplexStart + j]].x * contact.pointB[j];
}
Vector3 normal = contact.normal;
//Gizmos.DrawSphere(point + normal.normalized * frame.contacts[i].distance, 0.01f);
Gizmos.DrawSphere(point + normal * radius, 0.01f);
Gizmos.DrawRay(point + normal * radius, normal.normalized * contact.distance);
}*/
Gizmos.DrawRay(point + normal * radius, normal.normalized * contact.distance);
}
}
}
/*
[RequireComponent(typeof(ObiSolver))]
public class CollisionEventHandler : MonoBehaviour {
ObiSolver solver;
public int counter = 0;
public Collider targetCollider = null;
HashSet<int> particles = new HashSet<int>();
void Awake(){
solver = GetComponent<Obi.ObiSolver>();
}
void OnEnable () {
solver.OnCollision += Solver_OnCollision;
}
void OnDisable(){
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision (object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
HashSet<int> currentParticles = new HashSet<int>();
for(int i = 0; i < e.contacts.Count; ++i)
{
if (e.contacts.Data[i].distance < 0.001f)
{
Component collider;
if (ObiCollider.idToCollider.TryGetValue(e.contacts.Data[i].other,out collider)){
if (collider == targetCollider)
currentParticles.Add(e.contacts.Data[i].particle);
}
}
}
particles.ExceptWith(currentParticles);
counter += particles.Count;
particles = currentParticles;
}
}
*/
/*[RequireComponent(typeof(ObiSolver))]
public class CollisionEventHandler : MonoBehaviour {
ObiSolver solver;
public Collider targetCollider = null;
void Awake(){
solver = GetComponent<Obi.ObiSolver>();
}
void OnEnable () {
solver.OnCollision += Solver_OnCollision;
}
void OnDisable(){
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision (object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
for(int i = 0; i < e.contacts.Count; ++i)
{
if (e.contacts.Data[i].distance < 0.001f)
{
Component collider;
if (ObiCollider.idToCollider.TryGetValue(e.contacts.Data[i].other,out collider)){
if (collider == targetCollider)
solver.viscosities[e.contacts.Data[i].particle] = Mathf.Max(0,solver.viscosities[e.contacts.Data[i].particle] - 0.1f * Time.fixedDeltaTime);
}
}
}
}
}*/

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
namespace Obi.Samples
namespace Obi
{
/**
* Sample script that colors fluid particles based on their vorticity (2D only)
@@ -22,7 +22,7 @@ namespace Obi.Samples
if (!isActiveAndEnabled || actor.solver == null)
return;
for (int i = 0; i < actor.solverIndices.count; ++i)
for (int i = 0; i < actor.solverIndices.Length; ++i)
{
int k = actor.solverIndices[i];

View File

@@ -3,7 +3,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
namespace Obi.Samples
namespace Obi
{
/**
* Sample script that colors fluid particles based on their vorticity (2D only)
@@ -25,7 +25,7 @@ namespace Obi.Samples
if (!isActiveAndEnabled || actor.solver == null)
return;
for (int i = 0; i < actor.solverIndices.count; ++i){
for (int i = 0; i < actor.solverIndices.Length; ++i){
int k = actor.solverIndices[i];

View File

@@ -1,6 +1,9 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Obi.Samples
namespace Obi
{
[RequireComponent(typeof(ObiActor))]
public class ColorRandomizer : MonoBehaviour
@@ -11,16 +14,13 @@ namespace Obi.Samples
void Start()
{
actor = GetComponent<ObiActor>();
actor.OnBlueprintLoaded += Actor_OnBlueprintLoaded;
}
private void Actor_OnBlueprintLoaded(ObiActor a, ObiActorBlueprint blueprint)
{
for (int i = 0; i < actor.solverIndices.count; ++i)
for (int i = 0; i < actor.solverIndices.Length; ++i)
{
actor.solver.colors[actor.solverIndices[i]] = gradient.Evaluate(UnityEngine.Random.value);
}
}
}
}
}
}
}

View File

@@ -1,42 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
{
[ExecuteInEditMode]
[RequireComponent(typeof(ObiActor))]
public class DebugParticleFrames : MonoBehaviour
[ExecuteInEditMode]
[RequireComponent(typeof(ObiActor))]
public class DebugParticleFrames : MonoBehaviour {
ObiActor actor;
public float size = 1;
public void Awake()
{
ObiActor actor;
public float size = 1;
public void Awake()
actor = GetComponent<ObiActor>();
}
// Update is called once per frame
void OnDrawGizmos ()
{
Vector4 b1 = new Vector4(1, 0, 0, 0);
Vector4 b2 = new Vector4(0, 1, 0, 0);
Vector4 b3 = new Vector4(0, 0, 1, 0);
for (int i = 0; i < actor.activeParticleCount; ++i)
{
actor = GetComponent<ObiActor>();
}
// Update is called once per frame
void OnDrawGizmos()
{
Vector4 b1 = new Vector4(1, 0, 0, 0);
Vector4 b2 = new Vector4(0, 1, 0, 0);
Vector4 b3 = new Vector4(0, 0, 1, 0);
for (int i = 0; i < actor.activeParticleCount; ++i)
{
Vector3 position = actor.GetParticlePosition(actor.solverIndices[i]);
Quaternion quat = actor.GetParticleOrientation(actor.solverIndices[i]);
Gizmos.color = Color.red;
Gizmos.DrawRay(position, quat * b1 * size);
Gizmos.color = Color.green;
Gizmos.DrawRay(position, quat * b2 * size);
Gizmos.color = Color.blue;
Gizmos.DrawRay(position, quat * b3 * size);
}
}
}
Vector3 position = actor.GetParticlePosition(actor.solverIndices[i]);
Quaternion quat = actor.GetParticleOrientation(actor.solverIndices[i]);
Gizmos.color = Color.red;
Gizmos.DrawRay(position, quat * b1 * size);
Gizmos.color = Color.green;
Gizmos.DrawRay(position, quat * b2 * size);
Gizmos.color = Color.blue;
Gizmos.DrawRay(position, quat * b3 * size);
}
}
}

View File

@@ -1,78 +1,76 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
public class ExtrapolationCamera : MonoBehaviour
{
public class ExtrapolationCamera : MonoBehaviour
public Transform target = null;
public float extrapolation = 10;
[Range(0, 1)]
public float smoothness = 0.8f;
[Range(0, 1)]
public float linearSpeed = 1;
[Range(0, 1)]
public float rotationalSpeed = 1;
[Min(0)]
public float distanceFromTarget = 4;
Vector3 lastPosition;
Vector3 extrapolatedPos;
void Start()
{
public Transform target = null;
if (target != null)
lastPosition = target.position;
}
public float extrapolation = 10;
[Range(0, 1)]
public float smoothness = 0.8f;
[Range(0, 1)]
public float linearSpeed = 1;
[Range(0, 1)]
public float rotationalSpeed = 1;
[Min(0)]
public float distanceFromTarget = 4;
Vector3 lastPosition;
Vector3 extrapolatedPos;
void Start()
private void FixedUpdate()
{
if (target != null)
{
if (target != null)
lastPosition = target.position;
}
// Get position delta since the last physics update:
Vector3 positionDelta = target.position - lastPosition;
positionDelta.y = 0;
private void FixedUpdate()
{
if (target != null)
{
// Get position delta since the last physics update:
Vector3 positionDelta = target.position - lastPosition;
positionDelta.y = 0;
// extrapolate position using velocity (the division/multiplication by Time.deltaTime simplify out)
extrapolatedPos = Vector3.Lerp(target.position + positionDelta * extrapolation, extrapolatedPos, smoothness);
// extrapolate position using velocity (the division/multiplication by Time.deltaTime simplify out)
extrapolatedPos = Vector3.Lerp(target.position + positionDelta * extrapolation, extrapolatedPos, smoothness);
// store the target's current com for the next frame:
lastPosition = target.position;
}
}
void LateUpdate()
{
if (target != null)
{
// get vector from the camera to the extrapolated position:
Vector3 toTarget = extrapolatedPos - transform.position;
// rotate the camera towards the extrapolated position:
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(toTarget), rotationalSpeed);
// keep our current world space height:
toTarget.y = 0;
// move the camera towards the extrapolated position, keeping some distance to it:
transform.position += toTarget.normalized * (toTarget.magnitude - distanceFromTarget) * linearSpeed;
}
}
public void Teleport(Vector3 position, Quaternion rotation)
{
transform.position = position;
transform.rotation = rotation;
if (target != null)
extrapolatedPos = lastPosition = target.position;
// store the target's current com for the next frame:
lastPosition = target.position;
}
}
void LateUpdate()
{
if (target != null)
{
// get vector from the camera to the extrapolated position:
Vector3 toTarget = extrapolatedPos - transform.position;
// rotate the camera towards the extrapolated position:
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(toTarget), rotationalSpeed);
// keep our current world space height:
toTarget.y = 0;
// move the camera towards the extrapolated position, keeping some distance to it:
transform.position += toTarget.normalized * (toTarget.magnitude - distanceFromTarget) * linearSpeed;
}
}
public void Teleport(Vector3 position, Quaternion rotation)
{
transform.position = position;
transform.rotation = rotation;
if (target != null)
extrapolatedPos = lastPosition = target.position;
}
}

View File

@@ -2,59 +2,56 @@
using UnityEngine.UI;
using System.Collections;
namespace Obi.Samples
[RequireComponent(typeof(Text))]
public class FPSDisplay : MonoBehaviour
{
[RequireComponent(typeof(Text))]
public class FPSDisplay : MonoBehaviour
public float updateInterval = 0.5f;
public bool showMedian = false;
public float medianLearnrate = 0.05f;
private float accum = 0; // FPS accumulated over the interval
private int frames = 0; // Frames drawn over the interval
private float timeleft; // Left time for current interval
private float currentFPS = 0;
private float median = 0;
private float average = 0;
public float CurrentFPS{
get { return currentFPS; }
}
public float FPSMedian
{
public float updateInterval = 0.5f;
get { return median; }
}
public bool showMedian = false;
public float medianLearnrate = 0.05f;
public float FPSAverage
{
get { return average; }
}
private float accum = 0; // FPS accumulated over the interval
private int frames = 0; // Frames drawn over the interval
private float timeleft; // Left time for current interval
private float currentFPS = 0;
Text uguiText;
private float median = 0;
private float average = 0;
void Start()
{
uguiText = GetComponent<Text>();
timeleft = updateInterval;
}
public float CurrentFPS
{
get { return currentFPS; }
}
void Update()
{
// Timing inside the editor is not accurate. Only use in actual build.
public float FPSMedian
{
get { return median; }
}
public float FPSAverage
{
get { return average; }
}
Text uguiText;
void Start()
{
uguiText = GetComponent<Text>();
timeleft = updateInterval;
}
void Update()
{
// Timing inside the editor is not accurate. Only use in actual build.
//#if !UNITY_EDITOR
//#if !UNITY_EDITOR
timeleft -= Time.deltaTime;
accum += Time.timeScale / Time.deltaTime;
accum += Time.timeScale/Time.deltaTime;
++frames;
// Interval ended - update GUI text and start new interval
if (timeleft <= 0.0)
if( timeleft <= 0.0)
{
currentFPS = accum / frames;
@@ -63,19 +60,18 @@ namespace Obi.Samples
// display two fractional digits (f2 format)
float fps = showMedian ? median : currentFPS;
uguiText.text = System.String.Format("{0:F2} FPS ({1:F1} ms)", fps, 1000.0f / fps);
uguiText.text = System.String.Format("{0:F2} FPS ({1:F1} ms)", fps, 1000.0f / fps);
timeleft = updateInterval;
accum = 0.0F;
frames = 0;
}
//#endif
}
//#endif
}
public void ResetMedianAndAverage()
{
median = 0;
average = 0;
}
public void ResetMedianAndAverage()
{
median = 0;
average = 0;
}
}

View File

@@ -1,6 +1,6 @@
using UnityEngine;
namespace Obi.Samples
namespace Obi
{
[RequireComponent(typeof(Camera))]
public class LookAroundCamera : MonoBehaviour
@@ -64,10 +64,7 @@ namespace Obi.Samples
currentShot.position += delta * Time.deltaTime * movementSpeed;
var system = UnityEngine.EventSystems.EventSystem.current;
bool focusUI = system != null && system.IsPointerOverGameObject();
if (Input.GetKey(KeyCode.Mouse0) && !focusUI)
if (Input.GetKey(KeyCode.Mouse0))
{
float deltaX = Input.GetAxis("Mouse X") * rotationSpeed;
float deltaY = Input.GetAxis("Mouse Y") * rotationSpeed;

View File

@@ -1,7 +1,7 @@
using System;
using UnityEngine;
namespace Obi.Samples
namespace Obi
{
public class MoveAndRotate : MonoBehaviour
{

View File

@@ -1,17 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
public class ObiActorTeleport : MonoBehaviour
{
public class ObiActorTeleport : MonoBehaviour
{
public ObiActor actor;
public Transform target;
public ObiActor actor;
public Transform target;
public void Teleport()
{
actor.Teleport(target.position, target.rotation);
}
public void Teleport()
{
actor.Teleport(target.position, target.rotation);
}
}

View File

@@ -1,58 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
namespace Obi.Samples
{
[RequireComponent(typeof(ObiSolver))]
public class ObiParticleCounter : MonoBehaviour
{
[RequireComponent(typeof(ObiSolver))]
public class ObiParticleCounter : MonoBehaviour {
ObiSolver solver;
public int counter = 0;
public Collider2D targetCollider = null;
ObiNativeContactList frame;
HashSet<int> particles = new HashSet<int>();
void Awake()
{
solver = GetComponent<Obi.ObiSolver>();
}
void OnEnable()
{
solver.OnCollision += Solver_OnCollision;
}
void OnDisable()
{
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision(object sender, ObiNativeContactList e)
{
HashSet<int> currentParticles = new HashSet<int>();
for (int i = 0; i < e.count; ++i)
{
if (e[i].distance < 0.001f)
{
/*Component collider;
if (ObiCollider2D.idToCollider.TryGetValue(e.contacts.Data[i].other,out collider)){
if (collider == targetCollider)
currentParticles.Add(e.contacts.Data[i].particle);
}*/
}
}
particles.ExceptWith(currentParticles);
counter += particles.Count;
particles = currentParticles; Debug.Log(counter);
}
ObiSolver solver;
public int counter = 0;
public Collider2D targetCollider = null;
Obi.ObiSolver.ObiCollisionEventArgs frame;
HashSet<int> particles = new HashSet<int>();
void Awake(){
solver = GetComponent<Obi.ObiSolver>();
}
void OnEnable () {
solver.OnCollision += Solver_OnCollision;
}
void OnDisable(){
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision (object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
HashSet<int> currentParticles = new HashSet<int>();
for(int i = 0; i < e.contacts.Count; ++i)
{
if (e.contacts.Data[i].distance < 0.001f)
{
/*Component collider;
if (ObiCollider2D.idToCollider.TryGetValue(e.contacts.Data[i].other,out collider)){
if (collider == targetCollider)
currentParticles.Add(e.contacts.Data[i].particle);
}*/
}
}
particles.ExceptWith(currentParticles);
counter += particles.Count;
particles = currentParticles;Debug.Log(counter);
}
}

View File

@@ -1,25 +1,23 @@
using UnityEngine;
using System.Collections;
namespace Obi.Samples
public class ObjectDragger : MonoBehaviour
{
public class ObjectDragger : MonoBehaviour
{
private Vector3 screenPoint;
private Vector3 offset;
void OnMouseDown()
{
screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
}
void OnMouseDrag()
{
Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
transform.position = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
}
private Vector3 screenPoint;
private Vector3 offset;
void OnMouseDown()
{
screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
}
void OnMouseDrag()
{
Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
transform.position = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
}
}
}

View File

@@ -1,25 +1,22 @@
using UnityEngine;
using System.Collections;
namespace Obi.Samples
{
public class ObjectLimit : MonoBehaviour
{
public float minX = 0;
public float maxX = 1;
public float minY = 0;
public float maxY = 1;
public float minZ = 0;
public float maxZ = 1;
void Update()
{
transform.localPosition = new Vector3(Mathf.Clamp(gameObject.transform.localPosition.x, minX, maxX),
Mathf.Clamp(gameObject.transform.localPosition.y, minY, maxY),
Mathf.Clamp(gameObject.transform.localPosition.z, minZ, maxZ));
}
}
}
public class ObjectLimit : MonoBehaviour
{
public float minX = 0;
public float maxX = 1;
public float minY = 0;
public float maxY = 1;
public float minZ = 0;
public float maxZ = 1;
void Update()
{
transform.localPosition = new Vector3(Mathf.Clamp(gameObject.transform.localPosition.x,minX,maxX),
Mathf.Clamp(gameObject.transform.localPosition.y,minY,maxY),
Mathf.Clamp(gameObject.transform.localPosition.z,minZ,maxZ));
}
}

View File

@@ -1,24 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Obi.Samples
{
[RequireComponent(typeof(Rigidbody))]
public class RigidbodyMaxAngularVel : MonoBehaviour
{
public float maxAngularVelocity = 20;
// Start is called before the first frame update
void Start()
{
GetComponent<Rigidbody>().maxAngularVelocity = maxAngularVelocity;
}
// Update is called once per frame
void Update()
{
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0c31446bcaf82443aa64afa152fac3d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2,14 +2,9 @@
using System.Collections.Generic;
using UnityEngine;
namespace Obi.Samples
{
public class SlowmoToggler : MonoBehaviour
{
public class SlowmoToggler : MonoBehaviour {
public void Slowmo(bool slowmo)
{
Time.timeScale = slowmo ? 0.25f : 1;
}
}
public void Slowmo (bool slowmo) {
Time.timeScale = slowmo?0.25f:1;
}
}

View File

@@ -1,24 +1,21 @@
using UnityEngine;
using Obi;
namespace Obi.Samples
[RequireComponent(typeof(ObiSolver))]
public class WorldSpaceGravity : MonoBehaviour
{
[RequireComponent(typeof(ObiSolver))]
public class WorldSpaceGravity : MonoBehaviour
ObiSolver solver;
public Vector3 worldGravity = new Vector3(0,-9.81f,0);
void Awake()
{
solver = GetComponent<ObiSolver>();
}
ObiSolver solver;
public Vector3 worldGravity = new Vector3(0, -9.81f, 0);
void Awake()
{
solver = GetComponent<ObiSolver>();
}
void Update()
{
solver.parameters.gravity = transform.InverseTransformDirection(worldGravity);
solver.PushSolverParameters();
}
void Update()
{
solver.parameters.gravity = transform.InverseTransformDirection(worldGravity);
solver.PushSolverParameters();
}
}