Compare commits

..

12 Commits

Author SHA1 Message Date
Vuk
390832fdf9 more sounds 2024-08-18 16:27:33 +02:00
Vuk
409876fd7b more product and some UI sounds 2024-08-18 15:59:20 +02:00
Vuk
f0d2afdca9 product good and product bad sounds 2024-08-18 15:47:15 +02:00
Vuk
f04451eecf Merge branch 'master' of https://github.com/nothke/quality-control 2024-08-18 14:50:34 +02:00
Vuk
0f5a0d5ede scan gun added 2024-08-18 14:50:31 +02:00
Khauvinkh
683f839905 Reworking item spawn, adding item conversion. 2024-08-18 14:44:44 +02:00
nothke
d2c3dff101 Added interaction, hand, rigidbody dragging, picking up hammer 2024-08-18 13:21:38 +02:00
Vuk
93ecc95bfa Merge branch 'master' of https://github.com/nothke/quality-control 2024-08-18 12:55:57 +02:00
Vuk
a15d77aae9 hammered the hammer 2024-08-18 12:55:45 +02:00
nothke
07e3a5d7a7 Merge branch 'master' of https://github.com/nothke/quality-control 2024-08-18 12:51:18 +02:00
Vuk
36b0df53ea hammer! 2024-08-18 12:49:16 +02:00
nothke
9e3adbfa11 Strip doors 2024-08-18 12:31:25 +02:00
148 changed files with 9095 additions and 769 deletions

BIN
Assets/Audio/Player/tool_pickup.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/Product/product_bad.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/Product/product_drop.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/Product/product_good.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/Product/product_pickup.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/Scanner/scanner_not-an-item.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/Scanner/scanner_scan.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/UI/buttonclick.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/UI/buttonclickrelease.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Audio/UI/buttonrollover.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a80c2e8703664de8943062f03eedfe17, type: 3}
m_Name: Crates
m_Name: Crates Schedule
m_EditorClassIdentifier:
Products:
- Prefab: {fileID: 8661871210265028242, guid: ca01f03442732704ba414883790643f7, type: 3}

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a80c2e8703664de8943062f03eedfe17, type: 3}
m_Name: Defective Crates
m_Name: Defective Crates Schedule
m_EditorClassIdentifier:
Products:
- Prefab: {fileID: 8661871210265028242, guid: c150b9eb048821c47a8d6083804e00e0, type: 3}

8
Assets/Data/Types.meta Normal file
View File

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

View File

@ -0,0 +1,15 @@
%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: bcf4ec4eb272446d850eb3c9e72cd87f, type: 3}
m_Name: Original E
m_EditorClassIdentifier:
Prefab: {fileID: 1892923323752838125, guid: 67d17fe30a51b794899db51da3f9fddb, type: 3}

View File

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

View File

@ -0,0 +1,22 @@
%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: bcf4ec4eb272446d850eb3c9e72cd87f, type: 3}
m_Name: Produced E
m_EditorClassIdentifier:
Prefab: {fileID: 4275785426082247918, guid: 14d16caaceafb634f87449e796c4543a, type: 3}
DefectProbabilities:
- Defect: 0
Probability: 50
- Defect: 1024
Probability: 25
- Defect: 2048
Probability: 25

View File

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

View File

@ -0,0 +1,84 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: emissive_magenta
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0, b: 0.8627451, a: 1}
- _EmissionColor: {r: 1.1892071, g: 0, b: 0.8511081, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 568b3806fe9d062479776cf082c0fd7b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Meshes/hammer.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 284d0eff2a70da04dbcbde75060e045d
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
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: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
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: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
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: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Meshes/products.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 4c6f4b5005eaee14b8214635df8d4049
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
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: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
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: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
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: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Meshes/qa_scanner.fbx (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Meshes/strip_door.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 0fb2a63eed0d5f348b48df9ead960fb2
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
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: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
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: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
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: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Meshes/trashbin.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 2ec19dda799c8744292de0274474475b
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
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: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
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: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
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: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,30 @@
#### Simple interaction
- Add `InteractionController` component to your camera
- You must provide an input for the controller, so add `ExampleInteractionControllerInput` to the same object. Implement your own to provide custom input.
- Drop `Example Interaction Canvas.prefab` into the scene to get some UI feedback. If you wish to customize it, make a copy of the prefab and customize as you wish.
- To create an interactable object, create a new script and inherit `Nothke.Interaction.Interactable`. Override `void Use(InteractableController im)` and add `Debug.Log("Hello, interactable!")`. When you click on it, you should get a message in your log.
#### Holding Items
Item handling is a separate system that builds on top of simple interaction. It is managed by the `Hands` component, residing in `Nothke.Interaction.Items` namespace, which manages taking, throwing, interacting with held items etc.
- Add a `Hands` component to where your `InteractionController` is (you can also assign it to the handsComponent property on the InteractionController if you don't want to put it on the same object);
- Now if you create a new script that inherits `Interactable` and also implements `ITakeable`, you will be able to take it;
- Note that you will have to also implement IDroppable to be able to drop the item
#### Specifying interactable behavior
Specifying interaction on interactables is handled via interfaces. For example `ITakeable` makes the interactable takeable, while `IScrollInteractable` makes it possible to implement value changing when interacting with the mouse scroll wheel. Or you can specify which item can interact with which item by implementing `IItemInHandsInteractionDependable` or `ICanInteract`. See [InteractionInterfaces.cs](Runtime/Core/InteractionInterfaces.cs) for a full list of built-in interaction interfaces.
#### Default implementations
The package also provides a few default implementations of aformentioned interfaces, which can be inherited for a much easier implmentation, such as:
- `GenericItem` which implements holdable item in a single class, behavior of which can be configured in the inspector, or by overriding virtual functions;
- `Slot` provides a default implementation for slotting, that is, an interactable that can accept another item. I.e. an electricity socket which can accept a plug.
So, why is "low level" implmementation provided via interfaces and not via classes like these? Well, because there could be conflicting behaviors, like, what if I want to make a takeable item, which is also a slot? You can totally do that with just implmementing all the necessary interfaces.
#### Interfacing with other game features
InteractionController needs to interact with a few features that depend on your implemention in your project, such as mouse look locking. This functionality is done by providing the InteractionController with interfaces, these are located in [IntegrationInterfaces.cs](Runtime/Integration/IntegrationInterfaces.cs).
#### UI
The package provides an implementation of a simple UI, which shows an interactable's label and also shows a reticle that changes on the item behavior. Best is if you use this as an example of how to implement your own UI.
#### To be changed in the future:
- The project currently uses reticle sprites that are managed by `ReticleUI.cs` and switch according to an enum. It should either be changed to a class that can be extended, or removed completely and user should be encouraged to create their own.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4bc51f0323be70a4e9a6fe407e458eee
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@ -0,0 +1,37 @@
using UnityEngine;
using System.Collections;
namespace Nothke.Interaction
{
public class Interactable : MonoBehaviour
{
[HideInInspector]
public InteractionController manager;
[System.Serializable]
public class Info
{
public string name;
//public string descriptionShort;
//[Multiline()]
//public string description;
}
public Info info;
public virtual string Label => info.name;
public virtual void Use(InteractionController im)
{
manager = im;
//Debug.Log("No use");
}
public virtual void OnHover() { }
public virtual void OnDehover() { }
public virtual void StartHold() { }
public virtual void EndHold() { }
public virtual void UseHold() { }
}
}

View File

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

View File

@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Nothke.Interaction
{
public static class InteractableUtils
{
public static Vector3 GetMousePointOnPlane(Plane plane)
{
Vector3 screenPoint = Input.mousePosition;
Ray screenRay = Camera.main.ScreenPointToRay(Input.mousePosition);
float e = 0;
if (plane.Raycast(screenRay, out e))
screenPoint.z = e;
return screenRay.GetPoint(e);
}
public static Vector3 GetJointAnchorInWorldSpace(Joint joint)
{
if (!joint.connectedBody) return joint.connectedAnchor;
return joint.connectedBody.transform.TransformPoint(joint.connectedAnchor);
}
public static bool IsNonUniform(this Transform transform)
{
Vector3 ls = transform.lossyScale;
return !(Mathf.Approximately(ls.x, ls.y) && Mathf.Approximately(ls.y, ls.z));
}
}
}

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 6d67801240ba9824885c0e8255eda458
timeCreated: 1530288663
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,342 @@
//#define NEVER_MOUSE_RAY
#define USE_FIXED_UPDATE
using UnityEngine;
using Nothke.Interaction.Items;
using Nothke.Interaction.Integration;
namespace Nothke.Interaction
{
public class InteractionController : MonoBehaviour
{
Transform originTransform;
public float interactDistance = 2;
public bool rayModeToggling = false;
public bool mouseRay = false;
public MonoBehaviour lockableFreeLookComponent;
ILockableFreeLook lockableFreeLook;
Interactable interactable;
Interactable lastHovered;
public Interactable hovered { get; private set; }
public MonoBehaviour handsComponent;
public IHands hands;
public LayerMask raycastLayerMask = -1;
[HideInInspector]
public Vector3 startScreenPosition;
[System.NonSerialized]
public RaycastHit hit;
[System.NonSerialized]
public bool hasHit;
bool LMB;
bool LMBup;
bool rayModeToggleDown;
bool freezeDetection;
public bool detectionFrozen => freezeDetection;
bool isDetached;
bool wasMouseRayBeforeTemp;
public delegate void HoverAction(Interactable interactable);
public event HoverAction OnHover;
public delegate void DehoverAction();
public event DehoverAction OnDehover;
public delegate void RayModeChangeAction(bool enable);
public event RayModeChangeAction OnRayModeChange;
public bool debug;
Camera cam;
protected Ray interactionRay;
private void Awake()
{
if (handsComponent)
{
hands = handsComponent.GetComponent<IHands>();
hands.controller = this;
Debug.Assert(hands != null, "Assigned component doesn't implement IHands");
}
else
{
hands = GetComponent<IHands>();
if (hands != null)
hands.controller = this;
}
}
void Start()
{
cam = Camera.main;
if (lockableFreeLookComponent)
{
lockableFreeLook = lockableFreeLookComponent.GetComponent<ILockableFreeLook>();
if (lockableFreeLook == null)
Debug.Log("ILockableFreeLook not found on assigned component", lockableFreeLookComponent);
}
originTransform = transform;
Dehover();
SetRayMode(mouseRay);
}
public void SetTempRayOrigin(Transform t)
{
originTransform = t;
}
public void ResetTempRayOrigin()
{
originTransform = transform;
}
public void SetInput(bool interactDown, bool interactUp, bool rayModeChangeDown)
{
LMB = interactDown;
LMBup = interactUp;
this.rayModeToggleDown = rayModeChangeDown;
}
public void UpdateRaycast()
{
if (mouseRay)
interactionRay = cam.ScreenPointToRay(Input.mousePosition);
else
interactionRay = new Ray(originTransform.position, originTransform.forward);
hovered = null;
// DETECTION - Raycast
if (!freezeDetection)
{
GameObject hito = GetInteractingObject();
if (hito)
{
hasHit = true;
hovered = hito.GetComponentInParent<Interactable>();
// Prevent interaction with items that don't want to be interacted with
// unless holding a certain item
if (hovered is IItemInHandsInteractionDependable)
{
if (hands == null)
hovered = null;
else
if (!(hovered as IItemInHandsInteractionDependable).IsInteractableIfHolding(hands.item))
hovered = null;
}
// Prevent interaction if item in hands prevents interaction
if (hands != null && hands.item && hands.item is IEnvironmentInteractionPreventable eip)
{
if (!eip.EnvironmentInteractionIsAllowed)
hovered = null;
}
#pragma warning disable CS0618 // Type or member is obsolete
if (hovered is ISelectiveInteractable)
{
if (!(hovered as ISelectiveInteractable).CanInteract)
hovered = null;
}
#pragma warning restore CS0618 // Type or member is obsolete
if (hovered is ICanInteract)
{
if (!(hovered as ICanInteract).CanInteract(this))
hovered = null;
}
if (hovered != lastHovered && hovered != null)
Hover(hovered);
}
else hasHit = false;
if (hovered != lastHovered && hovered == null)
Dehover();
}
}
/// <summary>
/// Override this to provide a custom raycaster for example. You can get the default provided ray from interactionRay.
/// </summary>
protected virtual GameObject GetInteractingObject()
{
if (Physics.Raycast(interactionRay, out hit, interactDistance, raycastLayerMask))
return hit.collider.gameObject;
else return null;
}
/// <summary>
/// Call this after you set input. Should be called in Update()
/// </summary>
public void UpdateInput()
{
// On click
bool interactedThisFrame = false;
if (hovered && LMB)
{
interactable = hovered;
if (hands != null && interactable is ITakeable)
{
if (interactable is ISelectiveTakeable)
{
if ((interactable as ISelectiveTakeable).CanBeTaken())
hands.Take(interactable as ITakeable);
}
else
hands.Take(interactable as ITakeable);
}
interactable.Use(this);
interactable.StartHold();
interactedThisFrame = true;
startScreenPosition = Input.mousePosition;
}
// On scroll
if (hovered && hovered is IScrollInteractable scrollInteractable)
{
float scroll = Input.mouseScrollDelta.y;
if (scroll != 0)
scrollInteractable.Scroll(this, scroll);
}
// On release
if (interactable && LMBup)
{
interactable.EndHold();
interactable = null;
}
lastHovered = hovered;
LMB = false;
LMBup = false;
if (!interactedThisFrame && hands != null)
hands.UpdateInteraction();
}
public void Recast()
{
hovered = null;
}
void ToggleRayMode()
{
mouseRay = !mouseRay;
SetRayMode(mouseRay);
}
public void FreezeDetection()
{
freezeDetection = true;
hovered = null;
}
public void UnfreezeDetection()
{
freezeDetection = false;
Dehover();
Recast();
}
public void SetTempMouseRay(bool tempMouse)
{
if (tempMouse)
{
wasMouseRayBeforeTemp = mouseRay;
SetRayMode(true);
}
else
{
if (!wasMouseRayBeforeTemp)
{
SetRayMode(false);
}
}
}
public void SetRayMode(bool isMouse)
{
mouseRay = isMouse;
#if !NEVER_MOUSE_RAY
if (mouseRay)
{
Cursor.lockState = CursorLockMode.None;
// TODO: if windows
//System.Windows.Forms.Cursor.Position = new System.Drawing.Point(10, 10);
}
else
{
Cursor.lockState = CursorLockMode.Locked;
//System.Windows.Forms.Cursor.Position = new System.Drawing.Point(Screen.width / 2, Screen.height / 2);
}
#endif
if (lockableFreeLook != null)
lockableFreeLook.LockFreeLook(mouseRay);
else
Debug.LogWarning("No freelook lockable");
OnRayModeChange?.Invoke(mouseRay);
if (debug)
Debug.Log("Ray mode changed to " + (mouseRay ? " Mouse" : " Center"));
//Cursor.visible = mouseRay;
if (hands != null)
hands.isFixed = mouseRay;
}
void Hover(Interactable interactable)
{
interactable.OnHover();
OnHover?.Invoke(interactable);
if (debug)
Debug.Log("Hovered " + interactable.name);
}
void Dehover()
{
if (lastHovered)
lastHovered.OnDehover();
OnDehover?.Invoke();
if (debug)
Debug.Log("Dehovered");
}
public void LockFreeLook(bool b)
{
if (lockableFreeLook != null)
lockableFreeLook.LockFreeLook(b);
}
}
}

View File

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

View File

@ -0,0 +1,145 @@
using UnityEngine;
namespace Nothke.Interaction
{
public interface IScrollInteractable
{
void Scroll(InteractionController im, float scroll);
}
[System.Obsolete("Use ICanInteract instead")]
public interface ISelectiveInteractable
{
bool CanInteract { get; }
}
public interface ICanInteract
{
bool CanInteract(InteractionController controller);
}
}
namespace Nothke.Interaction.Items
{
public interface IUsable
{
void Use();
}
public interface IHoldUsable
{
void UseEnd();
}
public interface IScrollableInHand
{
void ScrollInHand(float scroll);
}
public interface ISecondaryUsable
{
bool AllowExamination { get; }
void UseSecondary();
}
public interface ITakeable
{
Transform Transform { get; }
Rigidbody Rigidbody { get; }
void OnTaken(IHands hands);
}
public interface ICustomHoldPivot
{
void GetHoldPivot(out Vector3 holdPos, out Quaternion holdRot);
}
public interface IHands
{
Interactable item { get; }
void Take(ITakeable _item);
void Drop();
void DropFixed();
void UpdateInteraction();
bool isFixed { get; set; }
void Place(Vector3 position, Quaternion rotation, Transform relativeParent, IItemReceivable intoSlot = null);
InteractionController controller { get; set; }
}
public interface ISelectiveTakeable
{
bool CanBeTaken();
}
public interface IDroppable
{
Transform Transform { get; }
Rigidbody Rigidbody { get; }
void OnDropped(IHands hands);
bool DelayDrop { get; }
}
public interface IThrowable
{
Rigidbody Rigidbody { get; }
bool canThrow { get; }
float minThrowAcceleration { get; }
float maxThrowAcceleration { get; }
void OnDropped(IHands hands);
}
public interface INicePlaceable
{
void GetPlacePivot(out Vector3 placePos, out Quaternion placeRot);
void OnStartedPlacing(IHands hands);
void OnNicePlaced(IHands hands);
}
public interface IExaminable
{
float HorizontalAngle { get; }
float VerticalAngle { get; }
}
public interface ICustomExaminePosition
{
Vector3 ExaminePosition { get; }
}
public interface ICustomHandPosition
{
Vector3 HandsOffset { get; }
}
/// <summary>
/// Sets position of held hand
/// </summary>
public interface IOverrideHandPositon
{
Vector3 HandPosition { get; }
}
/// <summary>
/// Adds offset translation to held hand
/// </summary>
public interface IOffsetHandPosition
{
Vector3 HandPositionOffset { get; }
}
/// <summary>
/// Implement this if you want to prevent held items interacting with other (environment) interactables
/// </summary>
public interface IEnvironmentInteractionPreventable
{
bool EnvironmentInteractionIsAllowed { get; }
}
/// <summary>
/// Implement this on interactables that you want to be interactable only if the player is holding a certain item
/// </summary>
public interface IItemInHandsInteractionDependable
{
bool IsInteractableIfHolding(Interactable item);
}
}

View File

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

View File

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

View File

@ -0,0 +1,44 @@
using UnityEngine;
namespace Nothke.Interaction.Example
{
public class ExampleInteractionControllerInput : MonoBehaviour
{
public InteractionController controller;
public Items.Hands hands;
public int interactMouseButton = 0;
public int rayModeChangeMouseButton = 1;
public KeyCode dropKey = KeyCode.Q;
public KeyCode throwKey = KeyCode.F;
public KeyCode examineKey = KeyCode.E;
public KeyCode placeKey = KeyCode.T;
private void Update()
{
controller.SetInput(
Input.GetMouseButtonDown(interactMouseButton),
Input.GetMouseButtonUp(interactMouseButton),
Input.GetMouseButtonDown(rayModeChangeMouseButton));
if (hands)
{
hands.SetInput(new Items.Hands.HandsInput()
{
useDown = Input.GetMouseButtonDown(0),
useUp = Input.GetMouseButtonUp(0),
dropDown = Input.GetKeyDown(dropKey),
throwDown = Input.GetKeyDown(throwKey),
throwUp = Input.GetKeyUp(throwKey),
examineDown = Input.GetKeyDown(examineKey),
examineUp = Input.GetKeyUp(examineKey),
placeDown = Input.GetKeyDown(placeKey)
});
}
controller.UpdateInput();
controller.UpdateRaycast();
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Nothke.Interaction.Items;
namespace Nothke.Interaction.Integration
{
public interface ILockableFreeLook
{
void LockFreeLook(bool _lock);
}
public interface IFocusableEffect
{
void FocusEffect(bool focus, float distance);
}
public interface IZoomable
{
void ZoomIn(bool _zoomIn);
}
}

View File

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

View File

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

View File

@ -0,0 +1,141 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Nothke.Interaction.Items
{
public class GenericItem : Interactable,
ITakeable, IDroppable, IThrowable, INicePlaceable,
IExaminable, ICustomHoldPivot
{
[System.Serializable]
public class ItemSettings
{
//public Vector3 customHoldPosition = new Vector3(0.15f, -0.15f, 0.1f);
public Transform holdPivot;
public Collider[] collidersToDisable;
public bool autoPopulateColliderListFromChildren;
public bool useCustomExaminePosition;
public Vector3 customExaminePosition = new Vector3(0, 0, 0.15f);
public float examineHorizontalAngle = 90;
public float examineVerticalAngle = 90;
public bool canBeThrown = true;
public float minThrowVelocity = 5;
public float maxThrowVelocity = 10;
public Transform nicePlacePivot;
}
public ItemSettings itemSettings;
public Transform Transform => transform;
public Rigidbody Rigidbody => rb;
public bool DelayDrop => false;
public float HorizontalAngle => itemSettings.examineHorizontalAngle;
public float VerticalAngle => itemSettings.examineVerticalAngle;
protected Rigidbody rb;
Collider col;
public bool canThrow => itemSettings.canBeThrown;
public float minThrowAcceleration => itemSettings.minThrowVelocity;
public float maxThrowAcceleration => itemSettings.maxThrowVelocity;
protected virtual void Awake()
{
rb = GetComponentInParent<Rigidbody>();
col = GetComponent<Collider>();
Debug.Assert(rb, "GenericItem has no Rigidbody", this);
if ((!itemSettings.holdPivot && transform.IsNonUniform()) ||
(itemSettings.holdPivot && itemSettings.holdPivot.IsNonUniform()))
Debug.LogError("GenericItem's scale (or its hold pivot's scale) is non-uniform, this is not allowed. Placement will be skewed.", this);
}
private void OnValidate()
{
if (itemSettings == null)
itemSettings = new ItemSettings();
if (itemSettings.autoPopulateColliderListFromChildren)
{
itemSettings.collidersToDisable = GetComponentsInChildren<Collider>(true);
}
}
public virtual void OnDropped(IHands hands)
{
SetCollisions(true);
FixRigidbody(false);
}
public virtual void OnTaken(IHands hands)
{
SetCollisions(false);
FixRigidbody(true);
}
public virtual void OnStartedPlacing(IHands hands)
{
}
public virtual void OnNicePlaced(IHands hands)
{
SetCollisions(true);
rb.isKinematic = false;
}
protected void SetCollisions(bool enable)
{
if (col)
col.enabled = enable;
foreach (Collider col in itemSettings.collidersToDisable)
col.enabled = enable;
}
public void FixRigidbody(bool fix)
{
rb.interpolation = fix ? RigidbodyInterpolation.None : RigidbodyInterpolation.Interpolate;
rb.isKinematic = fix;
}
public void GetHoldPivot(out Vector3 holdPos, out Quaternion holdRot)
{
if (!itemSettings.holdPivot)
{
holdPos = Vector3.zero;
holdRot = Quaternion.identity;
}
else
{
holdPos = itemSettings.holdPivot.localPosition;
holdRot = itemSettings.holdPivot.localRotation;
}
}
public void GetPlacePivot(out Vector3 placePos, out Quaternion placeRot)
{
if (!itemSettings.nicePlacePivot)
{
Bounds bounds = Utils.BoundsUtils.GetObjectSpaceColliderBounds(gameObject, true);
placePos = bounds.center;
placePos.y = bounds.min.y;
placeRot = Quaternion.identity;
//Debug.Log("Got bounds offset: " + placePos.y);
}
else
{
placePos = itemSettings.nicePlacePivot.localPosition;
placeRot = itemSettings.nicePlacePivot.localRotation;
}
}
}
}

View File

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

View File

@ -0,0 +1,579 @@
using System.Collections.Generic;
using Nothke.Interaction.Integration;
using UnityEngine;
using UnityEngine.UI;
namespace Nothke.Interaction.Items
{
public class Hands : MonoBehaviour, IHands
{
#region Inspector variables
public Transform hand;
public Vector3 handAimPos = new Vector3(0, 0, 0.8f);
public float examinationMouseSensitivity = 1;
[Header("Smooth taking")]
public bool smoothTake;
public float smoothMoveFactor = 0.1f;
public float smoothRotateRate = 10;
[Header("Throwing")]
public bool throwFromCenter = true;
public float throwUpFactor = 0.2f;
public float throwAngularVelocity = 10;
public Transform throwTransform;
public float handNoiseGain = 1;
[System.NonSerialized] public MonoBehaviour[] mouseLooks; // TODO: Remove
public MonoBehaviour lockableFreeLookComponent;
ILockableFreeLook lockableFreeLook;
public MonoBehaviour focusEffectComponent;
IFocusableEffect focusableEffect;
public bool nicePlacement;
public bool disableShadowsOnTakenObjects = true;
#endregion
#region Public properties
public bool isFixed { get; set; }
[System.NonSerialized] public Interactable item;
#endregion
#region Private variables
const float smoothPlaceTimeLimit = 1;
Transform itemInHands;
Vector3 handStartPos;
Vector3 handTargetPos;
Quaternion handStartRot;
Quaternion handTargetRot;
RaycastHit hit;
Vector3 mouseSpeed;
Vector3 handRefVelo;
#if FOV
float originalFoV;
float FoVRefVelo;
#endif
Interactable IHands.item => item;
public InteractionController controller { get; set; }
Vector3 placeTLocalPos;
Quaternion placeTLocalRot;
Vector3 placeHandOffset;
Quaternion placeHandRotation;
Transform placeT;
bool placing;
bool placingIsNice;
float placeStartTime;
Transform handParent;
#endregion
#region Public methods
public void Take(ITakeable _item)
{
if (itemInHands) return;
item = _item as Interactable;
if (_item.Rigidbody)
_item.Rigidbody.isKinematic = true;
var itemT = _item.Transform;
Vector3 targetHoldPos = Vector3.zero;
Quaternion targetHoldRot = Quaternion.identity;
if (item is ICustomHoldPivot)
(item as ICustomHoldPivot).GetHoldPivot(out targetHoldPos, out targetHoldRot);
if (smoothTake)
{
hand.transform.SetPositionAndRotation(
itemT.TransformPoint(targetHoldPos),
itemT.rotation * targetHoldRot);
}
itemT.parent = hand;
if (!smoothTake)
{
itemT.localPosition = -targetHoldPos;
itemT.localRotation = Quaternion.Inverse(targetHoldRot);
}
if (disableShadowsOnTakenObjects)
EnableShadowcasting(item, true);
itemInHands = _item.Transform;
_item.OnTaken(this);
}
public void Drop()
{
if (!itemInHands) return;
var droppable = item as IDroppable;
if (droppable == null) Debug.LogError("Attempting to drop undroppable item");
Debug.Assert(droppable != null, "Droppable is null");
//Debug.Assert(droppable.Rigidbody != null, "Item rigidbody is null");
if (droppable.Rigidbody)
droppable.Rigidbody.isKinematic = false;
itemInHands.parent = null;
if (disableShadowsOnTakenObjects)
EnableShadowcasting(item, true);
Debug.Log($"Dropped {item.name}");
itemInHands = null;
item = null;
}
public void DropFixed()
{
if (!itemInHands) return;
itemInHands.parent = null;
if (disableShadowsOnTakenObjects)
EnableShadowcasting(item, true);
Debug.Log($"Dropped fixed {item.name}");
if (item is IDroppable droppable)
droppable.OnDropped(this);
itemInHands = null;
item = null;
}
void EnableShadowcasting(Interactable item, bool enable)
{
Renderer[] renderers = item.transform.GetComponentsInChildren<Renderer>(); // alloc!
for (int i = 0; i < renderers.Length; i++)
renderers[i].shadowCastingMode =
enable ?
UnityEngine.Rendering.ShadowCastingMode.On :
UnityEngine.Rendering.ShadowCastingMode.Off;
}
IItemReceivable placingIntoSlot;
public void Place(Vector3 position, Quaternion rotation, Transform relativeParent, IItemReceivable intoSlot = null)
{
placeT = relativeParent;
placeTLocalPos = position;
placeTLocalRot = rotation;
placing = true;
if (item is ICustomHoldPivot)
(item as ICustomHoldPivot).GetHoldPivot(out placeHandOffset, out placeHandRotation);
else
{
placeHandOffset = Vector3.zero;
placeHandRotation = Quaternion.identity;
}
if (item is INicePlaceable placeable)
placeable.OnStartedPlacing(this);
else if (item is ISlottable slottable)
slottable.OnStartedPlacing(this);
placingIsNice = placeT == null;
placingIntoSlot = intoSlot;
// TODO: Add movement velocity to smoothing speed
placeStartTime = Time.time;
hand.parent = null;
}
public void OverrideHandPositionAndRotation(Vector3 pos, Quaternion rot)
{
handTargetPos = pos;
handTargetRot = rot;
}
public void SetHandVelocity(Vector3 velo)
{
handRefVelo = velo;
}
public void ResetOffset()
{
handTargetPos = handStartPos;
handTargetRot = handStartRot;
}
#endregion
void Awake()
{
if (hand == null)
hand = transform;
handStartPos = hand.transform.localPosition;
handTargetPos = handStartPos;
handStartRot = hand.transform.localRotation;
handTargetRot = handStartRot;
if (lockableFreeLookComponent)
{
lockableFreeLook = lockableFreeLookComponent.GetComponent<ILockableFreeLook>();
if (lockableFreeLook != null)
Debug.Log("Found lockable free look on GameObject");
}
if (focusEffectComponent)
{
focusableEffect = focusEffectComponent.GetComponent<IFocusableEffect>();
if (focusableEffect != null)
Debug.Log("Found focusable effect on GameObject");
}
handParent = hand.parent;
}
#region Update
private void Update()
{
UpdatePosition();
}
public void UpdatePosition()
{
// sanity check
if (item == null)
if (placing)
{
this.EndPlacing();
}
float dt = Time.deltaTime;
mouseSpeed = new Vector3(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"), 0);
Vector3 targetPos = handTargetPos;
if (item is IOverrideHandPositon ohp)
{
targetPos = ohp.HandPosition;
}
if (item is IOffsetHandPosition offhp)
{
targetPos += offhp.HandPositionOffset;
}
float lrRot = (-0.5f + Mathf.PerlinNoise(Time.time * 3.34f, 0.234f)) * 5 * handNoiseGain;
float udRot = (-0.5f + Mathf.PerlinNoise(Time.time * 3.34f, 34.783f)) * 5 * handNoiseGain;
Quaternion targetRot = handTargetRot * Quaternion.Euler(lrRot, udRot, 0);
if (placing)
{
// Get hold pivot offset and rotation
Vector3 holdPos = Vector3.zero;
Quaternion holdRot = Quaternion.identity;
if (item is ICustomHoldPivot chp)
{
chp.GetHoldPivot(out holdPos, out holdRot);
float slotScale = placeT ? 1.0f / placeT.lossyScale.x : 1;
holdPos = holdPos * item.transform.lossyScale.x * slotScale;
}
Vector3 placeWorldPos;
Quaternion placeWorldRot;
if (!placeT) // calcaulte in world space
{
Matrix4x4 worldLocationMatrix = Matrix4x4.TRS(placeTLocalPos, placeTLocalRot, Vector3.one);
Matrix4x4 handPivotMatrix = Matrix4x4.TRS(holdPos, holdRot, Vector3.one);
Vector3 posOff = worldLocationMatrix * holdPos;
//var mat = handPivotMatrix * worldLocationMatrix;
placeWorldPos = placeTLocalPos + (Vector3)(worldLocationMatrix * holdPos);
placeWorldRot = placeTLocalRot * holdRot;
//placeWorldRot = mat.rotation;
}
else // if placeT, calculate in local space of target object
{
placeWorldPos = placeT.TransformPoint(placeTLocalPos + holdPos);
placeWorldRot = placeT.rotation * placeTLocalRot * holdRot;
}
// Calculate targets in world space
targetPos = placeWorldPos;
targetRot = placeWorldRot;
bool isCloseToTarget = Vector3.Distance(hand.position, targetPos) < 0.02f;
bool isAngleCloseToTarget = Quaternion.Angle(hand.rotation, targetRot) < 1;
bool isSafetyTimeout = Time.time - placeStartTime > smoothPlaceTimeLimit;
// END PLACING
if ((isCloseToTarget && isAngleCloseToTarget) || isSafetyTimeout)
{
EndPlacing();
return;
}
}
// Assign hand position and rotation:
if (placing) // while placing is happening, lerping is in world space, otherwise it should be in localspace
{
hand.position = Vector3.SmoothDamp(hand.position, targetPos, ref handRefVelo, smoothMoveFactor);
hand.rotation = Quaternion.Slerp(hand.rotation, targetRot, dt * smoothRotateRate);
}
else
{
hand.localPosition = Vector3.SmoothDamp(hand.localPosition, targetPos, ref handRefVelo, smoothMoveFactor);
hand.localRotation = Quaternion.Slerp(hand.localRotation, targetRot, dt * smoothRotateRate);
}
if (examining)
{
if (itemInHands)
{
float x = mouseSpeed.x * examinationMouseSensitivity;
float y = mouseSpeed.y * examinationMouseSensitivity;
IExaminable examinable = item as IExaminable;
if (examinable != null)
{
if (examinable.HorizontalAngle > 0)
hand.Rotate(hand.transform.parent.up, x, Space.World);
if (examinable.VerticalAngle > 0)
hand.Rotate(hand.transform.parent.right, y, Space.World);
}
}
}
}
void EndPlacing()
{
placing = false;
// Temp, make it get velocity from target:
handRefVelo = Vector3.zero;
var _item = itemInHands;
if (_item != null)
{
DropFixed();
_item.parent = placeT;
_item.localPosition = placeTLocalPos;
_item.localRotation = placeTLocalRot;
}
else Debug.LogError("Ending placement but item was null! This shouldn't happen");
if (placingIsNice && _item.GetComponent<Interactable>() is INicePlaceable placeable)
placeable.OnNicePlaced(this);
//Debug.Log("Ending placeming");
if (placingIntoSlot != null)
Debug.Log("PLACINGINTOSLOT");
if (placingIntoSlot != null && _item.GetComponent<ISlottable>() != null)
placingIntoSlot.SetItemInSlot(_item.GetComponent<ISlottable>());
placeT = null;
placingIsNice = false;
hand.parent = handParent;
}
//bool gunning = false;
//public Transform gunningThing;
public struct HandsInput
{
public bool useDown;
public bool useUp;
public bool examineDown;
public bool examineUp;
public bool throwDown;
public bool throwUp;
public bool dropDown;
public bool placeDown;
}
HandsInput input;
public void SetInput(HandsInput input)
{
this.input = input;
}
public void UpdateInteraction()
{
#region Unused
/*
if (input.examineDown)
{
if (!gunning)
{
gunning = true;
OverrideHandPositionAndRotation(Vector3.forward * 0.3f, Quaternion.LookRotation(-Vector3.right + Vector3.forward * 0.4f));
GetComponent<InteractionController>().SetRayMode(true);
}
else
{
gunning = false;
ResetOffset();
GetComponent<InteractionController>().SetRayMode(false);
}
}
gunningThing.localPosition = Vector3.Lerp(gunningThing.localPosition, !gunning ? Vector3.down : Vector3.zero, Time.deltaTime * 10);
*/
// RMB
/*
if (input.useDown)
{
if (item is ISecondaryUsable usable)
{
usable.UseSecondary();
if (usable.AllowExamination)
StartAim();
}
else if (item is IExaminable examinable)
{
StartAim();
}
}*/
#endregion
if (placing)
return;
// RMB up
if (input.examineUp)
{
EndAim();
}
if (input.useDown)
{
if (item is IUsable usable)
usable.Use();
}
if (input.useUp && item is IHoldUsable holdUsable)
{
holdUsable.UseEnd();
}
if (Input.mouseScrollDelta.y != 0)
{
if (item is IScrollableInHand scrollable)
scrollable.ScrollInHand(Input.mouseScrollDelta.y);
}
if (input.dropDown && item is IDroppable)
{
IDroppable droppable = item as IDroppable;
droppable.OnDropped(this);
if (!droppable.DelayDrop)
Drop();
}
if (input.throwDown && item is IThrowable)
{
IThrowable throwable = item as IThrowable;
if (throwFromCenter)
{
hand.localPosition = new Vector3(0, 0, hand.localPosition.z);
if (throwTransform)
hand.position = throwTransform.position;
}
Drop();
throwable.OnDropped(this);
Vector3 throwFrw = throwTransform ? throwTransform.forward : transform.forward;
float throwSpeed = throwable.minThrowAcceleration;
Vector3 force = throwFrw * throwSpeed + Vector3.up * throwUpFactor;
throwable.Rigidbody.AddForce(force, ForceMode.VelocityChange);
throwable.Rigidbody.AddTorque(transform.forward * throwAngularVelocity, ForceMode.VelocityChange);
}
}
#endregion
#region Aiming
bool examining;
void StartAim()
{
examining = true;
if (item && item is ICustomExaminePosition cep)
handTargetPos = cep.ExaminePosition;
else
handTargetPos = handAimPos;
handTargetRot = Quaternion.identity;
LockFreeLook(true);
focusableEffect?.FocusEffect(true, handTargetPos.z);
}
void EndAim()
{
examining = false;
if (item && item is ICustomHandPosition chp)
handTargetPos = chp.HandsOffset;
else
handTargetPos = handStartPos;
handTargetRot = handStartRot;
LockFreeLook(false);
focusableEffect?.FocusEffect(false, 1000);
}
public void LockFreeLook(bool b)
{
if (mouseLooks != null)
for (int i = 0; i < mouseLooks.Length; i++)
mouseLooks[i].enabled = !b;
lockableFreeLook?.LockFreeLook(b);
}
#endregion
}
}

View File

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

View File

@ -0,0 +1,196 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Nothke.Interaction.Items;
using Nothke.Interaction.UI;
namespace Nothke.Interaction
{
public class Slot : Interactable, IItemReceivable, IItemInHandsInteractionDependable
{
public Transform slotPivot;
public string slotTag;
public virtual string SlotTag => slotTag;
public ISlottable itemInSlot;
public bool Occupied => itemInSlot != null;
public override string Label
{
get
{
if (itemInSlot != null)
return (itemInSlot as Interactable).Label;
return "";
}
}
#if UNITY_EDITOR
private void Awake()
{
if (slotPivot.IsNonUniform())
Debug.LogError("Slot lossy scale is not uniform, this is not allowed.", slotPivot);
}
#endif
public virtual bool IsInteractableIfHolding(Interactable item)
{
// if occupied and holding an item, not able to interact
if (item != null && itemInSlot != null)
return false;
// if occupied and not holding anything, able to take
if (item == null && itemInSlot != null)
return true;
var slottable = item as ISlottable;
if (slottable == null) return false;
if (!slottable.IsSlottable)
return false;
if (CanReceive(slottable))
return true;
return false;
}
public virtual bool CanReceive(ISlottable slottable)
{
if (itemInSlot != null) return false;
Debug.Assert(slottable != null, "CanReceive slottable is null");
if (slottable.SlotTag == SlotTag)
return true;
else return false;
}
public override void Use(InteractionController im)
{
manager = im;
SlotOrTake(im);
}
public void SlotOrTake(InteractionController im)
{
var hands = im.hands;
if (!hands.item && itemInSlot != null)
{
if (IsTakeable)
Take();
}
else
if (hands.item && hands.item is ISlottable)
{
SlotItemFromHands(hands);
}
}
public virtual bool IsTakeable => true;
public void Take()
{
if (itemInSlot == null)
{
Debug.LogError("Attempting to take an item from slot but there is none");
return;
}
var takeable = itemInSlot as ITakeable;
Debug.Assert(takeable != null, "Item is slottable but not takeable", this);
OnBeforeTaken();
manager.hands.Take(takeable);
itemInSlot.OnRemovedFromSlot();
itemInSlot.SlottedIn = null;
itemInSlot = null;
manager.Recast();
}
public void SlotItemFromHands(IHands hands)
{
if (CanReceive(hands.item as ISlottable))
{
manager.hands.Place(Vector3.zero, Quaternion.identity, slotPivot, this);
var item = hands.item;
// if not smooth placement:
//itemInSlot = item as ISlottable;
//itemInSlot.SlottedIn = this;
//itemInSlot.OnSlotted();
//OnSlot();
// if smooth placement, hands will callback the slot:
(item as ISlottable).OnStartedPlacing(hands);
}
}
public bool SetItemInSlot(ISlottable item)
{
Debug.Assert(item != null, "ISlottable passed is null");
//Debug.Log("Slotted " + (item as Component).gameObject.name + " into " + gameObject.name, this);
if (CanReceive(item))
{
var itemT = (item as Component).transform;
itemT.parent = slotPivot;
itemT.localPosition = Vector3.zero;
itemT.localRotation = Quaternion.identity;
itemInSlot = item;
item.SlottedIn = this;
item.OnSlotted();
OnSlot();
}
else
{
Debug.LogError("Slot can't receive this item, tags don't match OR already holding item", item as Component);
return false;
}
if (manager)
manager.Recast();
return true;
}
public ISlottable RemoveItemFromSlot()
{
var takeable = itemInSlot as ITakeable;
OnBeforeTaken();
var _item = itemInSlot;
itemInSlot = null;
(_item as Component).transform.SetParent(null);
_item.OnRemovedFromSlot();
_item.SlottedIn = null;
return _item;
}
public virtual void OnBeforeTaken() { }
public virtual void OnSlot() { }
public ReticleUI.State GetCustomReticle()
{
if (itemInSlot != null)
return ReticleUI.State.Take;
else
return ReticleUI.State.Slot;
}
}
}

View File

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

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Nothke.Interaction.Items;
namespace Nothke.Interaction
{
public interface ISlottable
{
string SlotTag { get; }
bool IsSlottable { get; }
void OnStartedPlacing(IHands hands);
void OnSlotted();
IItemReceivable SlottedIn { get; set; }
/// <summary>
/// Called before IsSlottable is nulled
/// </summary>
void OnRemovedFromSlot();
}
public interface IItemReceivable
{
string SlotTag { get; }
bool CanReceive(ISlottable slottable);
bool SetItemInSlot(ISlottable slottable);
}
}

View File

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

View File

@ -0,0 +1,15 @@
{
"name": "Nothke.Interaction",
"references": [
"GUID:6055be8ebefd69e48b49212b09b47b2f"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 902337b6423063d4693a927013a507f7
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,233 @@
using System;
using System.Collections;
using UnityEngine;
namespace Nothke.Interaction.Items
{
/// <summary>
/// Use this if mass of rigidbody changes while the rigidbody is being held
/// </summary>
public interface IDragRigidbodyReleaseMassSettable
{
float ReleaseMass { get; }
}
public class DragRigidbody : MonoBehaviour
{
public static DragRigidbody e;
private void Awake() { e = this; }
public float k_Spring = 50.0f;
public float k_Damper = 5.0f;
public float k_Drag = 0f;
public float k_AngularDrag = 0.0f;
public float k_Distance = 0.0001f;
public bool k_AttachToCenterOfMass = false;
public float distanceLimit = 2;
public float clampVelocity = 2;
public float clampExitVelocity = 2;
public float fakeMass = 0;
float originalMass;
Rigidbody body;
private ConfigurableJoint joint;
RigidbodyInterpolation originalInterpolation;
public bool Holding => joint && joint.connectedBody;
public event Action OnSlipped;
public bool Hitting { private set; get; }
float hitDistance;
private void Start()
{
CreateJoint();
}
void CreateJoint()
{
var go = new GameObject("Rigidbody dragger");
body = go.AddComponent<Rigidbody>();
//body.rotation = Quaternion.LookRotation(transform.forward, transform.up);
joint = go.AddComponent<ConfigurableJoint>();
body.isKinematic = true;
}
public float GetJointDistance()
{
if (joint && joint.connectedBody)
return Vector3.Distance(
body.position,
joint.connectedBody.transform.TransformPoint(joint.connectedAnchor));
else
return 0;
}
Quaternion addedRotation = Quaternion.identity;
[NonSerialized] public bool rotate;
[NonSerialized] public float rotateXInput;
[NonSerialized] public float rotateYInput;
bool overrideTarget = false;
Vector3 overrideTargetPoint;
public void OverrideTarget(Vector3 target)
{
overrideTarget = true;
overrideTargetPoint = target;
}
public void EndOverridingTarget()
{
overrideTarget = false;
}
public Vector3 GetFrontTargetPoint()
{
return new Ray(transform.position, transform.forward).GetPoint(hitDistance);
}
void FixedUpdate()
{
if (joint && joint.connectedBody)
{
//var ray = new Ray(transform.position, transform.forward);
Vector3 targetPoint = overrideTarget ? overrideTargetPoint :
GetFrontTargetPoint();
//ray.GetPoint(hitDistance);
joint.transform.position = targetPoint;
//joint.connectedBody.velocity = Vector3.ClampMagnitude(joint.connectedBody.velocity, clampVelocity);
//joint.targetRotation = transform.rotation;
//joint.targetRotation = UnityEngine.Random.rotation;
var bodyRot = body.rotation;
if (rotate)
{
float mx = rotateXInput * 10;
float my = rotateYInput * 10;
addedRotation =
Quaternion.AngleAxis(mx, Vector3.up) *
Quaternion.AngleAxis(my, Vector3.right) * addedRotation;
//addedRotation *= Quaternion.Euler(mx * 10, 0, my * 10);
//body.rotation = rot * addedRotation;
//body.MoveRotation(rot * Quaternion.Euler(4, 0, 0));
//joint.targetRotation = rot * Quaternion.Euler(4, 0, 0);
}
//Quaternion faceTo = Quaternion.Inverse(transform.rotation) * Quaternion.Euler(0, 90, 0);
//addedRotation = Quaternion.Slerp(addedRotation, faceTo, Time.deltaTime * 10);
body.rotation = transform.rotation * addedRotation;
if (GetJointDistance() > distanceLimit)
{
Slip();
}
return;
}
}
public void Slip()
{
End();
if (OnSlipped != null)
OnSlipped();
}
/*
private void Update()
{
if (Input.GetMouseButtonUp(0) && joint && joint.connectedBody)
End();
}*/
public void Attach(RaycastHit hit, bool fixedRotation = true)
{
Attach(hit.rigidbody, hit.point, hit.distance, fixedRotation);
}
public void Attach(Rigidbody rigidbody, Vector3 point, float distance, bool fixedRotation)
{
if (!joint) CreateJoint();
if (fakeMass > 0)
{
originalMass = rigidbody.mass;
rigidbody.mass = fakeMass;
}
originalInterpolation = rigidbody.interpolation;
rigidbody.interpolation = RigidbodyInterpolation.Interpolate;
joint.transform.position = point;
joint.anchor = Vector3.zero;
joint.transform.rotation = transform.rotation;
//joint.targetRotation = Quaternion.identity;
//joint.targetRotation = Quaternion.Inverse(transform.rotation);// Quaternion.LookRotation(transform.forward, transform.up);
joint.angularXMotion = joint.angularYMotion = joint.angularZMotion
= fixedRotation ? ConfigurableJointMotion.Locked : ConfigurableJointMotion.Free;
JointDrive drive = new JointDrive();
drive.positionSpring = k_Spring;
drive.positionDamper = k_Damper;
drive.maximumForce = Mathf.Infinity;
joint.xDrive = drive;
joint.yDrive = drive;
joint.zDrive = drive;
//joint.spring = k_Spring;
//joint.damper = k_Damper;
//joint.maxDistance = k_Distance;
joint.connectedBody = rigidbody;
hitDistance = distance;
}
public void End()
{
if (!joint.connectedBody)
return;
if (fakeMass > 0)
{
var massSettable = joint.connectedBody.GetComponent<IDragRigidbodyReleaseMassSettable>();
if (massSettable != null)
{
joint.connectedBody.mass = massSettable.ReleaseMass;
}
else
{
joint.connectedBody.mass = originalMass;
}
}
joint.connectedBody.interpolation = originalInterpolation;
if (clampExitVelocity > 0)
joint.connectedBody.velocity =
Vector3.ClampMagnitude(joint.connectedBody.velocity, clampExitVelocity);
addedRotation = Quaternion.identity;
joint.connectedBody = null;
overrideTarget = false;
}
}
}

View File

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

View File

@ -0,0 +1,63 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Nothke.Interaction.Items
{
public class RigidbodyInteractable : Interactable
{
public Rigidbody rb;
public bool rotateAroundPoint;
[System.NonSerialized]
public bool held;
private void Awake()
{
if (!rb)
rb = GetComponent<Rigidbody>();
}
public override void Use(InteractionController im)
{
base.Use(im);
DragRigidbody.e.Attach(im.hit, !rotateAroundPoint);
DragRigidbody.e.OnSlipped += Unhold;
}
public override void StartHold()
{
base.StartHold();
manager.FreezeDetection();
held = true;
OnStartedHold();
}
public override void EndHold()
{
base.EndHold();
if (!held)
return;
DragRigidbody.e.End();
Unhold();
}
void Unhold()
{
manager.UnfreezeDetection();
manager.LockFreeLook(false);
DragRigidbody.e.OnSlipped -= Unhold;
held = false;
OnEndedHold();
}
protected virtual void OnStartedHold() { }
protected virtual void OnEndedHold() { }
}
}

View File

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

View File

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

View File

@ -0,0 +1,176 @@
#define CENTER_TEXT
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if CENTER_TEXT
using TMPro;
#endif
using Nothke.Interaction.Items;
namespace Nothke.Interaction.UI
{
public interface ICustomReticle
{
ReticleUI.State GetCustomReticle();
}
public interface IReticleUIOverridable
{
bool OverrideUI { get; }
bool ReleaseInteractionBlocking { get; }
}
public class InteractionUI : MonoBehaviour
{
public static InteractionUI e;
private void Awake()
{
e = this;
controller = GetComponent<InteractionController>();
if (!controller) controller = FindObjectOfType<InteractionController>();
if (!controller)
{
Debug.LogError("No controller found");
enabled = false;
}
}
#if CENTER_TEXT
public TMP_Text centerText;
#endif
InteractionController controller;
bool mouseRay;
RigidbodyInteractable riHovered;
RigidbodyInteractable ri;
IReticleUIOverridable overridable;
bool ovrr;
private void OnEnable()
{
controller.OnHover += OnHover;
controller.OnDehover += OnDehover;
controller.OnRayModeChange += OnRayModeChange;
}
private void OnDisable()
{
controller.OnHover -= OnHover;
controller.OnDehover -= OnDehover;
controller.OnRayModeChange += OnRayModeChange;
}
#if CENTER_TEXT
public void SetText(string description)
{
centerText.enabled = true;
centerText.text = description;
}
public void HideText()
{
centerText.enabled = false;
}
#endif
protected virtual void OnHover(Interactable interactable)
{
if (ovrr) return;
#if CENTER_TEXT
if (centerText)
{
SetText(interactable.Label);
}
#endif
// Interactable icon choice
if (interactable is ICustomReticle)
{
ReticleUI.state = (interactable as ICustomReticle).GetCustomReticle();
}
else if (interactable is ITakeable)
{
ReticleUI.state = ReticleUI.State.Take;
}
else if (interactable is RigidbodyInteractable)
{
ReticleUI.state = ReticleUI.State.Grab;
riHovered = interactable as RigidbodyInteractable;
}
else
{
ReticleUI.state = ReticleUI.State.Idle;
}
if (interactable is IReticleUIOverridable)
{
overridable = interactable as IReticleUIOverridable;
}
}
private void Update()
{
if (overridable != null)
{
ovrr = overridable.OverrideUI;
if (ovrr == false)
{
OnDehover();
overridable = null;
}
}
if (riHovered && riHovered.held && ri == null)
{
ri = riHovered;
ovrr = true;
ReticleUI.state = ReticleUI.State.Hold;
}
if (ri && !ri.held)
{
ovrr = false;
OnDehover();
if (controller.hovered)
OnHover(controller.hovered);
ri = null;
}
if (controller.mouseRay)
{
ReticleUI.SetReticlePosition(Input.mousePosition);
}
}
protected virtual void OnDehover()
{
if (ovrr) return;
#if CENTER_TEXT
if (centerText)
centerText.enabled = false;
#endif
ReticleUI.state = ReticleUI.State.None;
}
protected virtual void OnRayModeChange(bool enable)
{
if (!enable)
ReticleUI.ResetReticlePosition();
}
}
}

View File

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

View File

@ -0,0 +1,95 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Nothke.Interaction.UI
{
public class ReticleUI : MonoBehaviour
{
static ReticleUI e;
private void Awake() { e = this; }
public bool showIconForNone;
public Texture icon_none;
public Texture icon_generic;
public Texture icon_grab;
public Texture icon_hold;
public Texture icon_take;
public Texture icon_slot;
public Texture icon_ride;
public Texture icon_scroll;
public Texture icon_grab_knob;
public Texture icon_hold_knob;
public RawImage image;
public enum State { None, Idle, Grab, Hold, Take, Slot, Ride, Scroll, GrabKnob, HoldKnob }
public static State state;
static State lastState;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private void Init()
{
state = State.None;
lastState = State.None;
}
public static void Hide()
{
state = State.None;
e.SetState();
}
public static void ResetReticlePosition()
{
if (!e) return;
RectTransform t = e.image.GetComponent<RectTransform>();
t.anchoredPosition = Vector2.zero;
}
public static void SetReticlePosition(Vector2 screenPos)
{
if (!e) return;
RectTransform t = e.image.GetComponent<RectTransform>();
t.position = screenPos;
}
private void Start()
{
SetState();
}
void Update()
{
if (state != lastState)
SetState();
lastState = state;
}
void SetState()
{
if (!showIconForNone)
image.enabled = state != State.None;
switch (state)
{
case State.None: image.texture = icon_none; break;
case State.Idle: image.texture = icon_generic; break;
case State.Grab: image.texture = icon_grab; break;
case State.Hold: image.texture = icon_hold; break;
case State.Take: image.texture = icon_take; break;
case State.Slot: image.texture = icon_slot; break;
case State.Ride: image.texture = icon_ride; break;
case State.Scroll: image.texture = icon_scroll; break;
case State.GrabKnob: image.texture = icon_grab_knob; break;
case State.HoldKnob: image.texture = icon_hold_knob; break;
}
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,113 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Nothke.Utils
{
public static class BoundsUtils
{
// static list for caching, never deallocates
static List<Collider> colliderCache = new List<Collider>();
public static Bounds GetObjectSpaceColliderBounds(GameObject go, bool includeInactive = false)
{
Transform t = go.transform;
var rootW2L = t.worldToLocalMatrix;
go.GetComponentsInChildren(includeInactive, colliderCache);
if (colliderCache.Count == 0)
{
Debug.LogError("Attempting to get bounds of the object but it has no colliders");
return default;
}
Bounds goBounds = GetBoundsInRootSpace(colliderCache[0]);
for (int i = 1; i < colliderCache.Count; i++)
{
Bounds b = GetBoundsInRootSpace(colliderCache[i]);
goBounds.Encapsulate(b);
}
return goBounds;
Bounds GetBoundsInRootSpace(Collider col)
{
Bounds b = col.GetLocalBounds();
Matrix4x4 l2w = col.transform.localToWorldMatrix;
Matrix4x4 local = rootW2L * l2w;
return TransformBounds(local, b);
}
}
public static Bounds GetLocalBounds(this Collider collider)
{
if (collider is BoxCollider)
{
BoxCollider box = (BoxCollider)collider;
return new Bounds(box.center, box.size);
}
else if (collider is SphereCollider)
{
var center = ((SphereCollider)collider).center;
var radius = ((SphereCollider)collider).radius;
Vector3 size = new Vector3(radius * 2, radius * 2, radius * 2);
return new Bounds(center, size);
}
else if (collider is CapsuleCollider)
{
var capsule = (CapsuleCollider)collider;
var r = capsule.radius;
var h = capsule.height;
Vector3 size;
switch (capsule.direction)
{
case 0: size = new Vector3(h, r * 2, r * 2); break;
case 1: size = new Vector3(r * 2, h, r * 2); break;
case 2: size = new Vector3(r * 2, r * 2, h); break;
default: size = default; break;
}
return new Bounds(capsule.center, size);
}
else if (collider is MeshCollider)
{
return ((MeshCollider)collider).sharedMesh.bounds;
}
Debug.LogError("Attempting to get bounds of an unknown collider type");
return new Bounds();
}
public static Bounds TransformBounds(in Matrix4x4 mat, in Bounds bounds)
{
// Find 8 corners of the bounds
Vector3 p0 = bounds.min;
Vector3 p1 = bounds.max;
Vector3 p2 = new Vector3(p0.x, p0.y, p1.z);
Vector3 p3 = new Vector3(p0.x, p1.y, p0.z);
Vector3 p4 = new Vector3(p1.x, p0.y, p0.z);
Vector3 p5 = new Vector3(p0.x, p1.y, p1.z);
Vector3 p6 = new Vector3(p1.x, p0.y, p1.z);
Vector3 p7 = new Vector3(p1.x, p1.y, p0.z);
Bounds b = new Bounds(mat * p0, Vector3.zero);
b.Encapsulate(mat * p1);
b.Encapsulate(mat * p2);
b.Encapsulate(mat * p3);
b.Encapsulate(mat * p4);
b.Encapsulate(mat * p5);
b.Encapsulate(mat * p6);
b.Encapsulate(mat * p7);
return b;
}
public static void DrawBoundsGizmos(in Bounds bounds)
{
Gizmos.DrawWireCube(bounds.center, bounds.size);
}
}
}

View File

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

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Nothke.Utils
{
public class HandSway : MonoBehaviour
{
public float springRate = 10;
public float softClampAngle = 30;
Quaternion lastRotation;
void Update()
{
Quaternion target = transform.parent.rotation;
lastRotation = Quaternion.Slerp(lastRotation, target, Time.deltaTime * springRate);
lastRotation = SoftClampRotation(target, lastRotation, softClampAngle);
transform.rotation = lastRotation;
}
public static Quaternion SoftClampRotation(Quaternion origin, Quaternion target, float limitAngleDegrees)
{
float angle = Quaternion.Angle(origin, target);
float softAngle = Mathf.Atan(angle * Mathf.PI / 2 / limitAngleDegrees) / Mathf.PI * 2 * limitAngleDegrees;
return Quaternion.RotateTowards(origin, target, softAngle); // note: uses degrees
}
}
}

View File

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

View File

@ -0,0 +1,89 @@
using System.Collections.Generic;
using UnityEngine;
namespace Nothke.Utils
{
public static class ObjectPreviewer
{
struct Node
{
public Matrix4x4 transform;
public Mesh mesh;
public Material[] mats;
}
// Static cache
static List<MeshFilter> meshFiltersBuffer;
static List<Node> nodes;
/// <summary>
/// For performance reasons, the cache never deallocates.
/// So, call this to clear the cache only in the case the memory becomes a problem, such as with previewing objects with gigantic hierarchies.
/// (but even if they're gigantic it's quite unlikely it will be a problem)
/// </summary>
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
public static void ReloadCache()
{
meshFiltersBuffer = new List<MeshFilter>();
nodes = new List<Node>();
}
/// <summary>
/// Assigns object for rendering. Call this only once on preview object change. Pass null to clear the object.
/// </summary>
public static void SetObject(GameObject go)
{
nodes.Clear();
meshFiltersBuffer.Clear();
if (go == null)
return;
Matrix4x4 rootW2L = go.transform.worldToLocalMatrix;
// We need to scale in case the root has non 1,1,1 scale
Matrix4x4 rootScaleMatrix = Matrix4x4.Scale(go.transform.localScale);
go.transform.GetComponentsInChildren(meshFiltersBuffer);
foreach (var mf in meshFiltersBuffer)
{
Mesh mesh = mf.sharedMesh;
var mr = mf.GetComponent<MeshRenderer>();
if (mesh == null)
continue;
// Un-transform by root
Matrix4x4 matrix = rootW2L * mf.transform.localToWorldMatrix * rootScaleMatrix;
Material[] mats = null;
if (mr != null)
mats = mr.sharedMaterials;
nodes.Add(new Node()
{
mesh = mesh,
transform = matrix,
mats = mats,
});
}
}
/// <summary>
/// Renders the preview object set with SetObject(). Call this every frame you want the object to be drawn.
/// </summary>
/// <param name="overrideMaterial">The replacement material that the previews will be drawn with. If not assigned, it will use the original material.</param>
public static void Render(Vector3 position, Quaternion rotation, Vector3 scale, Material overrideMaterial = null, int renderLayer = 0)
{
Matrix4x4 previewTransform = Matrix4x4.TRS(position, rotation, scale);
foreach (var node in nodes)
{
for (int subMeshIndex = 0; subMeshIndex < node.mesh.subMeshCount; subMeshIndex++)
{
var mat = overrideMaterial != null ? overrideMaterial : node.mats[Mathf.Clamp(subMeshIndex, 0, node.mats.Length)];
Graphics.DrawMesh(node.mesh, previewTransform * node.transform, mat, renderLayer, null, subMeshIndex);
}
}
}
}
}

View File

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

View File

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

View File

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

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_circle.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 3ae9c70fdf0754e4b8a3899fe78cf4a2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_dot.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: d3f4a03cbb6c2834cb8d594236317c99
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_drive.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: f9e024d86f3328d46b6b65f82d46d471
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_hand.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 29bcd55e61ee51240bc7b3338592f8f0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_hold.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 5ea0dbfdc11a38d48937b187123b1d69
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_slot.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: acbdd4ec64e5a2f419f4f50231ec2135
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 6cab33deb6d00fd43b66788b223d7cbd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,365 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8184360672608164086
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8184360672608164091}
- component: {fileID: 8184360672608164090}
- component: {fileID: 8184360672608164089}
- component: {fileID: 8184360672608164088}
- component: {fileID: 8184360672608164087}
m_Layer: 5
m_Name: Example Interaction Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8184360672608164091
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672608164086}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 8184360673128861479}
- {fileID: 8184360672637931736}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &8184360672608164090
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672608164086}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &8184360672608164089
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672608164086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &8184360672608164088
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672608164086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &8184360672608164087
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672608164086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81363621df3548e45ba871e78efd9d68, type: 3}
m_Name:
m_EditorClassIdentifier:
centerText: {fileID: 8184360673128861477}
--- !u!1 &8184360672637931735
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8184360672637931736}
- component: {fileID: 8184360672637931738}
- component: {fileID: 8184360672637931737}
- component: {fileID: 8184360672637931739}
m_Layer: 5
m_Name: Reticle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8184360672637931736
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672637931735}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8184360672608164091}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8184360672637931738
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672637931735}
m_CullTransparentMesh: 0
--- !u!114 &8184360672637931737
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672637931735}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 2800000, guid: d3f4a03cbb6c2834cb8d594236317c99, type: 3}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!114 &8184360672637931739
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360672637931735}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f225472c8049dc418e5a37e0cf6e0e8, type: 3}
m_Name:
m_EditorClassIdentifier:
showIconForNone: 1
icon_none: {fileID: 2800000, guid: d3f4a03cbb6c2834cb8d594236317c99, type: 3}
icon_generic: {fileID: 2800000, guid: 3ae9c70fdf0754e4b8a3899fe78cf4a2, type: 3}
icon_grab: {fileID: 2800000, guid: 29bcd55e61ee51240bc7b3338592f8f0, type: 3}
icon_hold: {fileID: 2800000, guid: 5ea0dbfdc11a38d48937b187123b1d69, type: 3}
icon_take: {fileID: 2800000, guid: 29bcd55e61ee51240bc7b3338592f8f0, type: 3}
icon_slot: {fileID: 2800000, guid: acbdd4ec64e5a2f419f4f50231ec2135, type: 3}
icon_ride: {fileID: 2800000, guid: f9e024d86f3328d46b6b65f82d46d471, type: 3}
image: {fileID: 8184360672637931737}
--- !u!1 &8184360673128861476
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8184360673128861479}
- component: {fileID: 8184360673128861478}
- component: {fileID: 8184360673128861477}
m_Layer: 5
m_Name: Item Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8184360673128861479
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360673128861476}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8184360672608164091}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 106}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &8184360673128861478
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360673128861476}
m_CullTransparentMesh: 0
--- !u!114 &8184360673128861477
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8184360673128861476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Item Text
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_VertexBufferAutoSizeReduction: 1
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 8184360673128861477}
characterCount: 9
spriteCount: 0
spaceCount: 1
wordCount: 2
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 222bdbca0de25cf4e91591bd07d6587c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
{
"name": "nothke.interaction",
"displayName": "Nothke's Interaction",
"version": "1.0.0",
"unity": "2018.1",
"description": "Interaction",
"type": "library"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: eca1d15c8646b8645b3b91a8b3f6eb9c
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,218 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7544640980504195214
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4308922499226473595}
- component: {fileID: 307974221925563946}
- component: {fileID: 593814420892732577}
m_Layer: 0
m_Name: Collider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4308922499226473595
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7544640980504195214}
serializedVersion: 2
m_LocalRotation: {x: -0.70710707, y: -0, z: -0, w: 0.7071066}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 200, y: 200, z: 200}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6297052809674953331}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!64 &307974221925563946
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7544640980504195214}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: -4284871513378854387, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
--- !u!114 &593814420892732577
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7544640980504195214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 813c296fdd6145aeaa5dfd4a2b2ca423, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &7947812480369148219
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6297052809674953331}
- component: {fileID: 4658930109992927606}
m_Layer: 0
m_Name: Basic Torus
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6297052809674953331
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7947812480369148219}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.375, z: 2.868}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3425455539473979036}
- {fileID: 4308922499226473595}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &4658930109992927606
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7947812480369148219}
serializedVersion: 4
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!1 &8478189424890482192
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3425455539473979036}
- component: {fileID: 2379847509244969485}
- component: {fileID: 181044875942612192}
m_Layer: 0
m_Name: Model
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3425455539473979036
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8478189424890482192}
serializedVersion: 2
m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071067}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 200, y: 200, z: 200}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6297052809674953331}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2379847509244969485
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8478189424890482192}
m_Mesh: {fileID: -8657128243768987584, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
--- !u!23 &181044875942612192
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8478189424890482192}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -6478536213147159724, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
- {fileID: -3846018093981099296, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
- {fileID: -2813467912831258332, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
- {fileID: -6922793697723135513, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
- {fileID: -6629797300637803691, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
- {fileID: 4874126678125670354, guid: 4c6f4b5005eaee14b8214635df8d4049, type: 3}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d5cbaa49bd379dc49b90d9c38f02bf80
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More