diff --git a/Assets/Meshes/hammer.fbx.meta b/Assets/Meshes/hammer.fbx.meta new file mode 100644 index 0000000..d6b945f --- /dev/null +++ b/Assets/Meshes/hammer.fbx.meta @@ -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: diff --git a/Assets/Plugins/Interaction.meta b/Assets/Plugins/Interaction.meta new file mode 100644 index 0000000..7b0b65f --- /dev/null +++ b/Assets/Plugins/Interaction.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f85848e00a41f4d45836e2763098c7b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/README.md b/Assets/Plugins/Interaction/README.md new file mode 100644 index 0000000..fba29e3 --- /dev/null +++ b/Assets/Plugins/Interaction/README.md @@ -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. \ No newline at end of file diff --git a/Assets/Plugins/Interaction/README.md.meta b/Assets/Plugins/Interaction/README.md.meta new file mode 100644 index 0000000..61873c1 --- /dev/null +++ b/Assets/Plugins/Interaction/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4bc51f0323be70a4e9a6fe407e458eee +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime.meta b/Assets/Plugins/Interaction/Runtime.meta new file mode 100644 index 0000000..5d539ed --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b2003b7f937eaeb45b7fab9ea84c1545 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Core.meta b/Assets/Plugins/Interaction/Runtime/Core.meta new file mode 100644 index 0000000..6ee9266 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0c06ebe8037b3d449ad53636b0a4b49a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Core/Interactable.cs b/Assets/Plugins/Interaction/Runtime/Core/Interactable.cs new file mode 100644 index 0000000..ddf7131 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/Interactable.cs @@ -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() { } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Core/Interactable.cs.meta b/Assets/Plugins/Interaction/Runtime/Core/Interactable.cs.meta new file mode 100644 index 0000000..a307ec6 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/Interactable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db4c87c72dc0dbd418a87afc01249dad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Core/InteractableUtils.cs b/Assets/Plugins/Interaction/Runtime/Core/InteractableUtils.cs new file mode 100644 index 0000000..5e71012 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/InteractableUtils.cs @@ -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)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Core/InteractableUtils.cs.meta b/Assets/Plugins/Interaction/Runtime/Core/InteractableUtils.cs.meta new file mode 100644 index 0000000..3072837 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/InteractableUtils.cs.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Runtime/Core/InteractionController.cs b/Assets/Plugins/Interaction/Runtime/Core/InteractionController.cs new file mode 100644 index 0000000..9e215b2 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/InteractionController.cs @@ -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(); + hands.controller = this; + Debug.Assert(hands != null, "Assigned component doesn't implement IHands"); + } + else + { + hands = GetComponent(); + if (hands != null) + hands.controller = this; + } + } + + void Start() + { + cam = Camera.main; + + if (lockableFreeLookComponent) + { + lockableFreeLook = lockableFreeLookComponent.GetComponent(); + + 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(); + + // 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(); + } + } + + /// + /// Override this to provide a custom raycaster for example. You can get the default provided ray from interactionRay. + /// + protected virtual GameObject GetInteractingObject() + { + if (Physics.Raycast(interactionRay, out hit, interactDistance, raycastLayerMask)) + return hit.collider.gameObject; + else return null; + } + + /// + /// Call this after you set input. Should be called in Update() + /// + 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); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Core/InteractionController.cs.meta b/Assets/Plugins/Interaction/Runtime/Core/InteractionController.cs.meta new file mode 100644 index 0000000..a4c1f78 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/InteractionController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb45815bc5df925448fc604ec327964b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Core/InteractionInterfaces.cs b/Assets/Plugins/Interaction/Runtime/Core/InteractionInterfaces.cs new file mode 100644 index 0000000..89db00f --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/InteractionInterfaces.cs @@ -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; } + } + + /// + /// Sets position of held hand + /// + public interface IOverrideHandPositon + { + Vector3 HandPosition { get; } + } + + /// + /// Adds offset translation to held hand + /// + public interface IOffsetHandPosition + { + Vector3 HandPositionOffset { get; } + } + + /// + /// Implement this if you want to prevent held items interacting with other (environment) interactables + /// + public interface IEnvironmentInteractionPreventable + { + bool EnvironmentInteractionIsAllowed { get; } + } + + /// + /// Implement this on interactables that you want to be interactable only if the player is holding a certain item + /// + public interface IItemInHandsInteractionDependable + { + bool IsInteractableIfHolding(Interactable item); + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Core/InteractionInterfaces.cs.meta b/Assets/Plugins/Interaction/Runtime/Core/InteractionInterfaces.cs.meta new file mode 100644 index 0000000..5cabda5 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Core/InteractionInterfaces.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d6a61181c3b9a7d40a2516b501df78c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Example.meta b/Assets/Plugins/Interaction/Runtime/Example.meta new file mode 100644 index 0000000..96460d3 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Example.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 26894b982e08af94c8e058bf230dc98b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Example/ExampleInteractionControllerInput.cs b/Assets/Plugins/Interaction/Runtime/Example/ExampleInteractionControllerInput.cs new file mode 100644 index 0000000..27036bb --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Example/ExampleInteractionControllerInput.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Example/ExampleInteractionControllerInput.cs.meta b/Assets/Plugins/Interaction/Runtime/Example/ExampleInteractionControllerInput.cs.meta new file mode 100644 index 0000000..20edd4d --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Example/ExampleInteractionControllerInput.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b8ad317191c930345bb55655eac9a932 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Integration.meta b/Assets/Plugins/Interaction/Runtime/Integration.meta new file mode 100644 index 0000000..bc15386 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Integration.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 220b2e02ec25d3941942cbed7225e0df +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Integration/IntegrationInterfaces.cs b/Assets/Plugins/Interaction/Runtime/Integration/IntegrationInterfaces.cs new file mode 100644 index 0000000..11c147e --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Integration/IntegrationInterfaces.cs @@ -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); + } +} diff --git a/Assets/Plugins/Interaction/Runtime/Integration/IntegrationInterfaces.cs.meta b/Assets/Plugins/Interaction/Runtime/Integration/IntegrationInterfaces.cs.meta new file mode 100644 index 0000000..8040665 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Integration/IntegrationInterfaces.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 869628a60cfb3be4b84024737f32c758 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Items.meta b/Assets/Plugins/Interaction/Runtime/Items.meta new file mode 100644 index 0000000..b3b4ae7 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ac69220ba77db048914abfa881f6fce +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Items/GenericItem.cs b/Assets/Plugins/Interaction/Runtime/Items/GenericItem.cs new file mode 100644 index 0000000..120869b --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/GenericItem.cs @@ -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(); + col = GetComponent(); + + 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(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; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Items/GenericItem.cs.meta b/Assets/Plugins/Interaction/Runtime/Items/GenericItem.cs.meta new file mode 100644 index 0000000..10a798b --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/GenericItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84817382e549d8b4797caa3a4891df6b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Items/Hands.cs b/Assets/Plugins/Interaction/Runtime/Items/Hands.cs new file mode 100644 index 0000000..2683a6b --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/Hands.cs @@ -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(); // 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(); + if (lockableFreeLook != null) + Debug.Log("Found lockable free look on GameObject"); + } + + if (focusEffectComponent) + { + focusableEffect = focusEffectComponent.GetComponent(); + 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() is INicePlaceable placeable) + placeable.OnNicePlaced(this); + + //Debug.Log("Ending placeming"); + if (placingIntoSlot != null) + Debug.Log("PLACINGINTOSLOT"); + + if (placingIntoSlot != null && _item.GetComponent() != null) + placingIntoSlot.SetItemInSlot(_item.GetComponent()); + + 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().SetRayMode(true); + } + else + { + gunning = false; + ResetOffset(); + GetComponent().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 + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Items/Hands.cs.meta b/Assets/Plugins/Interaction/Runtime/Items/Hands.cs.meta new file mode 100644 index 0000000..3515646 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/Hands.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff7c610785ea24144a1af4b97eb2ba39 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Items/Slot.cs b/Assets/Plugins/Interaction/Runtime/Items/Slot.cs new file mode 100644 index 0000000..23dbf31 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/Slot.cs @@ -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; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Items/Slot.cs.meta b/Assets/Plugins/Interaction/Runtime/Items/Slot.cs.meta new file mode 100644 index 0000000..f67fb9b --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/Slot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 668243f6f6db5be499bd28639ba7c669 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Items/Slots.cs b/Assets/Plugins/Interaction/Runtime/Items/Slots.cs new file mode 100644 index 0000000..3f943b1 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/Slots.cs @@ -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; } + + /// + /// Called before IsSlottable is nulled + /// + void OnRemovedFromSlot(); + } + + public interface IItemReceivable + { + string SlotTag { get; } + + bool CanReceive(ISlottable slottable); + bool SetItemInSlot(ISlottable slottable); + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Items/Slots.cs.meta b/Assets/Plugins/Interaction/Runtime/Items/Slots.cs.meta new file mode 100644 index 0000000..0c86f1c --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Items/Slots.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8738e65b425e1df4492657193fd2b9fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Nothke.Interaction.asmdef b/Assets/Plugins/Interaction/Runtime/Nothke.Interaction.asmdef new file mode 100644 index 0000000..e73f414 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Nothke.Interaction.asmdef @@ -0,0 +1,15 @@ +{ + "name": "Nothke.Interaction", + "references": [ + "GUID:6055be8ebefd69e48b49212b09b47b2f" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Nothke.Interaction.asmdef.meta b/Assets/Plugins/Interaction/Runtime/Nothke.Interaction.asmdef.meta new file mode 100644 index 0000000..c6627c3 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Nothke.Interaction.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 902337b6423063d4693a927013a507f7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Rigidbody.meta b/Assets/Plugins/Interaction/Runtime/Rigidbody.meta new file mode 100644 index 0000000..9c5f0d1 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Rigidbody.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa4d84620de80c74bad75c2327724d90 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Rigidbody/DragRigidbody.cs b/Assets/Plugins/Interaction/Runtime/Rigidbody/DragRigidbody.cs new file mode 100644 index 0000000..cd0d5c0 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Rigidbody/DragRigidbody.cs @@ -0,0 +1,233 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace Nothke.Interaction.Items +{ + /// + /// Use this if mass of rigidbody changes while the rigidbody is being held + /// + 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(); + //body.rotation = Quaternion.LookRotation(transform.forward, transform.up); + joint = go.AddComponent(); + 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(); + + 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; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Rigidbody/DragRigidbody.cs.meta b/Assets/Plugins/Interaction/Runtime/Rigidbody/DragRigidbody.cs.meta new file mode 100644 index 0000000..1db0a51 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Rigidbody/DragRigidbody.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e26630301387ce5469cfa0fb478b201b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Rigidbody/RigidbodyInteractable.cs b/Assets/Plugins/Interaction/Runtime/Rigidbody/RigidbodyInteractable.cs new file mode 100644 index 0000000..6780c66 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Rigidbody/RigidbodyInteractable.cs @@ -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(); + } + + 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() { } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Rigidbody/RigidbodyInteractable.cs.meta b/Assets/Plugins/Interaction/Runtime/Rigidbody/RigidbodyInteractable.cs.meta new file mode 100644 index 0000000..23b479e --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Rigidbody/RigidbodyInteractable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf9152fd8b7951445bef5e6f0778fd53 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/UI.meta b/Assets/Plugins/Interaction/Runtime/UI.meta new file mode 100644 index 0000000..fc87b44 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ea81ead1b5cbf7845be57adbbba3ab98 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/UI/InteractionUI.cs b/Assets/Plugins/Interaction/Runtime/UI/InteractionUI.cs new file mode 100644 index 0000000..73144a2 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/UI/InteractionUI.cs @@ -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(); + if (!controller) controller = FindObjectOfType(); + 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(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/UI/InteractionUI.cs.meta b/Assets/Plugins/Interaction/Runtime/UI/InteractionUI.cs.meta new file mode 100644 index 0000000..5d44e5d --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/UI/InteractionUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 81363621df3548e45ba871e78efd9d68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/UI/ReticleUI.cs b/Assets/Plugins/Interaction/Runtime/UI/ReticleUI.cs new file mode 100644 index 0000000..cf4c535 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/UI/ReticleUI.cs @@ -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(); + t.anchoredPosition = Vector2.zero; + } + + public static void SetReticlePosition(Vector2 screenPos) + { + if (!e) return; + RectTransform t = e.image.GetComponent(); + 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; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/UI/ReticleUI.cs.meta b/Assets/Plugins/Interaction/Runtime/UI/ReticleUI.cs.meta new file mode 100644 index 0000000..e441c12 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/UI/ReticleUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f225472c8049dc418e5a37e0cf6e0e8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Utils.meta b/Assets/Plugins/Interaction/Runtime/Utils.meta new file mode 100644 index 0000000..49f5055 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9a221522d7b5de645a6de4380762b321 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Utils/BoundsUtils.cs b/Assets/Plugins/Interaction/Runtime/Utils/BoundsUtils.cs new file mode 100644 index 0000000..90ddb1d --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils/BoundsUtils.cs @@ -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 colliderCache = new List(); + + 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); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Utils/BoundsUtils.cs.meta b/Assets/Plugins/Interaction/Runtime/Utils/BoundsUtils.cs.meta new file mode 100644 index 0000000..e6d74a5 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils/BoundsUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 10dcd8226f4ab2d498599806ceaf4ed7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Utils/HandSway.cs b/Assets/Plugins/Interaction/Runtime/Utils/HandSway.cs new file mode 100644 index 0000000..4c43fe1 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils/HandSway.cs @@ -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 + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Utils/HandSway.cs.meta b/Assets/Plugins/Interaction/Runtime/Utils/HandSway.cs.meta new file mode 100644 index 0000000..83a7680 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils/HandSway.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5fc4a4111f27864b8128645cf6c82b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Runtime/Utils/ObjectPreviewer.cs b/Assets/Plugins/Interaction/Runtime/Utils/ObjectPreviewer.cs new file mode 100644 index 0000000..fe14559 --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils/ObjectPreviewer.cs @@ -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 meshFiltersBuffer; + static List nodes; + + /// + /// 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) + /// + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] + public static void ReloadCache() + { + meshFiltersBuffer = new List(); + nodes = new List(); + } + + /// + /// Assigns object for rendering. Call this only once on preview object change. Pass null to clear the object. + /// + 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(); + + 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, + }); + } + } + + /// + /// Renders the preview object set with SetObject(). Call this every frame you want the object to be drawn. + /// + /// The replacement material that the previews will be drawn with. If not assigned, it will use the original material. + 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); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/Runtime/Utils/ObjectPreviewer.cs.meta b/Assets/Plugins/Interaction/Runtime/Utils/ObjectPreviewer.cs.meta new file mode 100644 index 0000000..125c7ed --- /dev/null +++ b/Assets/Plugins/Interaction/Runtime/Utils/ObjectPreviewer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 29d83e488182f784fb842823c959439b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Sample.meta b/Assets/Plugins/Interaction/Sample.meta new file mode 100644 index 0000000..54b74d1 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2d824383e2b705459ee4bf127a4687c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Sample/Art.meta b/Assets/Plugins/Interaction/Sample/Art.meta new file mode 100644 index 0000000..2e93be6 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e461af23d489719408b14414d2e4f3aa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_circle.png b/Assets/Plugins/Interaction/Sample/Art/reticle_circle.png new file mode 100644 index 0000000..53d76a0 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_circle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bdc68173f1f309ffe2fd163b31df9754c2f3bbf163130165f7ad433b93fff9f +size 18570 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_circle.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_circle.png.meta new file mode 100644 index 0000000..81b8c6f --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_circle.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_dot.png b/Assets/Plugins/Interaction/Sample/Art/reticle_dot.png new file mode 100644 index 0000000..cff12e1 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_dot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56e3da7ee1442b4ca11ffe869d924cbe3b85b2fcce30f4564b7c184753ed9120 +size 18253 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_dot.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_dot.png.meta new file mode 100644 index 0000000..750543c --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_dot.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_drive.png b/Assets/Plugins/Interaction/Sample/Art/reticle_drive.png new file mode 100644 index 0000000..f5dd8bc --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_drive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfad523e2a24ee02c02a3b47b6219bb3c699d4261edff8b31f39e706d3e0f93a +size 20517 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_drive.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_drive.png.meta new file mode 100644 index 0000000..a635bfb --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_drive.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_hand.png b/Assets/Plugins/Interaction/Sample/Art/reticle_hand.png new file mode 100644 index 0000000..e882956 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_hand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e80b0dde19427a134f09e0453ce4abce19afb9d395b39ecaf87fca40026ec0b4 +size 18992 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_hand.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_hand.png.meta new file mode 100644 index 0000000..47c27cc --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_hand.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_hold.png b/Assets/Plugins/Interaction/Sample/Art/reticle_hold.png new file mode 100644 index 0000000..1e3c41b --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_hold.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56bb706277aed1d85338b54db7a6208a115a5861a10d214a772f9ff7bebf51a6 +size 20516 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_hold.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_hold.png.meta new file mode 100644 index 0000000..0d00ced --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_hold.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_slot.png b/Assets/Plugins/Interaction/Sample/Art/reticle_slot.png new file mode 100644 index 0000000..7ff38da --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_slot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6e79a90d8736e93975a9b1d48aeb11bb9134d5c5473b36d01048b91012a5dbc +size 22935 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_slot.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_slot.png.meta new file mode 100644 index 0000000..93ce661 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_slot.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png b/Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png new file mode 100644 index 0000000..0b6b2ef --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c55eddb99a6337d14d6d2d0036435e31bb6725d4d176b2fe01a12a675d09acc +size 18413 diff --git a/Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png.meta b/Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png.meta new file mode 100644 index 0000000..488bf80 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Art/reticle_yoke.png.meta @@ -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: diff --git a/Assets/Plugins/Interaction/Sample/Example Interaction Canvas.prefab b/Assets/Plugins/Interaction/Sample/Example Interaction Canvas.prefab new file mode 100644 index 0000000..6add84a --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Example Interaction Canvas.prefab @@ -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} diff --git a/Assets/Plugins/Interaction/Sample/Example Interaction Canvas.prefab.meta b/Assets/Plugins/Interaction/Sample/Example Interaction Canvas.prefab.meta new file mode 100644 index 0000000..68a1ee8 --- /dev/null +++ b/Assets/Plugins/Interaction/Sample/Example Interaction Canvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 222bdbca0de25cf4e91591bd07d6587c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Interaction/package.json b/Assets/Plugins/Interaction/package.json new file mode 100644 index 0000000..771b4ab --- /dev/null +++ b/Assets/Plugins/Interaction/package.json @@ -0,0 +1,8 @@ +{ + "name": "nothke.interaction", + "displayName": "Nothke's Interaction", + "version": "1.0.0", + "unity": "2018.1", + "description": "Interaction", + "type": "library" +} \ No newline at end of file diff --git a/Assets/Plugins/Interaction/package.json.meta b/Assets/Plugins/Interaction/package.json.meta new file mode 100644 index 0000000..12fe650 --- /dev/null +++ b/Assets/Plugins/Interaction/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: eca1d15c8646b8645b3b91a8b3f6eb9c +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/crate_test.prefab b/Assets/Prefabs/crate_test.prefab index 7ab2686..0eb6728 100644 --- a/Assets/Prefabs/crate_test.prefab +++ b/Assets/Prefabs/crate_test.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 2547041061673746692} - component: {fileID: 3271489653354074546} - component: {fileID: 6230516344177671089} + - component: {fileID: 2268654696567863074} m_Layer: 0 m_Name: crate_test m_TagString: Untagged @@ -133,3 +134,20 @@ Rigidbody: m_Interpolate: 1 m_Constraints: 0 m_CollisionDetection: 0 +--- !u!114 &2268654696567863074 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cf9152fd8b7951445bef5e6f0778fd53, type: 3} + m_Name: + m_EditorClassIdentifier: + manager: {fileID: 0} + info: + name: + rb: {fileID: 0} + rotateAroundPoint: 0 diff --git a/Assets/Scenes/test_conveyor_belt_character.unity b/Assets/Scenes/test_conveyor_belt_character.unity index dc86c85..6736520 100644 --- a/Assets/Scenes/test_conveyor_belt_character.unity +++ b/Assets/Scenes/test_conveyor_belt_character.unity @@ -271,6 +271,229 @@ MonoBehaviour: m_BoolArgument: 0 m_CallState: 2 triggeredCollider: {fileID: 0} +--- !u!1 &139751024 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 139751029} + - component: {fileID: 139751028} + - component: {fileID: 139751027} + - component: {fileID: 139751026} + - component: {fileID: 139751030} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &139751026 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 139751024} + 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: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &139751027 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 139751024} + 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: 10303, guid: 0000000000000000f000000000000000, type: 0} + 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} +--- !u!33 &139751028 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 139751024} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &139751029 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 139751024} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 21.199, y: 0.34, z: 3.12} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &139751030 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 139751024} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 429d0776ebbb12d4e8adc0328a254f36, type: 3} + m_Name: + m_EditorClassIdentifier: + manager: {fileID: 0} + info: + name: +--- !u!1 &171556522 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 171556526} + - component: {fileID: 171556525} + - component: {fileID: 171556524} + - component: {fileID: 171556523} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &171556523 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171556522} + 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 &171556524 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171556522} + 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 + m_PresetInfoIsWorld: 0 +--- !u!223 &171556525 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171556522} + 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_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &171556526 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171556522} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1766686978} + m_Father: {fileID: 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!1001 &236143043 PrefabInstance: m_ObjectHideFlags: 0 @@ -323,9 +546,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 114014416615829144, guid: c75e91cf060bbf04e89204fa400606df, type: 3} + propertyPath: MaxDistance + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114014416615829144, guid: c75e91cf060bbf04e89204fa400606df, type: 3} + propertyPath: DefaultDistance + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] - m_AddedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 4353896453404184, guid: c75e91cf060bbf04e89204fa400606df, type: 3} + insertIndex: -1 + addedObject: {fileID: 1016565318} m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c75e91cf060bbf04e89204fa400606df, type: 3} --- !u!1001 &408158354 @@ -448,11 +682,198 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2043832388373371775, guid: d295472d4ce25404e9aed2627c34801f, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d295472d4ce25404e9aed2627c34801f, type: 3} +--- !u!4 &566203209 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + m_PrefabInstance: {fileID: 814546945} + m_PrefabAsset: {fileID: 0} +--- !u!1 &672825089 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 672825092} + - component: {fileID: 672825091} + - component: {fileID: 672825090} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &672825090 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672825089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &672825091 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672825089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &672825092 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672825089} + serializedVersion: 2 + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &702668098 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 702668100} + - component: {fileID: 702668099} + - component: {fileID: 702668101} + - component: {fileID: 702668102} + m_Layer: 0 + m_Name: Hammer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &702668099 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 702668098} + 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: 3 + m_Size: {x: 0.09041721, y: 0.7122681, z: 0.23208253} + m_Center: {x: 0, y: 0.08331621, z: 0} +--- !u!4 &702668100 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 702668098} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: 0.6087605, w: 0.79335415} + m_LocalPosition: {x: 12.282174, y: 0.052, z: 8.611328} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 566203209} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 75} +--- !u!114 &702668101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 702668098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84817382e549d8b4797caa3a4891df6b, type: 3} + m_Name: + m_EditorClassIdentifier: + manager: {fileID: 0} + info: + name: + itemSettings: + holdPivot: {fileID: 0} + collidersToDisable: [] + autoPopulateColliderListFromChildren: 0 + useCustomExaminePosition: 0 + customExaminePosition: {x: 0, y: 0, z: 0.15} + examineHorizontalAngle: 90 + examineVerticalAngle: 90 + canBeThrown: 1 + minThrowVelocity: 5 + maxThrowVelocity: 10 + nicePlacePivot: {fileID: 0} +--- !u!54 &702668102 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 702668098} + 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 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -602,7 +1023,10 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 8661871210265028242, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + insertIndex: -1 + addedObject: {fileID: 2014195378} m_SourcePrefab: {fileID: 100100000, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} --- !u!1001 &758750041 PrefabInstance: @@ -661,6 +1085,75 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} +--- !u!1001 &814546945 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 702668100} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalScale.x + value: 0.053949833 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalScale.y + value: 0.053949833 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalScale.z + value: 0.053949833 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalPosition.y + value: -0.028 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} + propertyPath: m_Name + value: hammer + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 284d0eff2a70da04dbcbde75060e045d, type: 3} --- !u!1 &826892522 GameObject: m_ObjectHideFlags: 0 @@ -777,6 +1270,162 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 76020eee813ed7844bcea94c5d5ce76a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1016565317 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1016565318} + - component: {fileID: 1016565320} + - component: {fileID: 1016565319} + - component: {fileID: 1016565321} + - component: {fileID: 1016565322} + - component: {fileID: 1016565323} + - component: {fileID: 1016565324} + m_Layer: 0 + m_Name: Interaction + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1016565318 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + serializedVersion: 2 + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2124761399} + m_Father: {fileID: 2085744658} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1016565319 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fb45815bc5df925448fc604ec327964b, type: 3} + m_Name: + m_EditorClassIdentifier: + interactDistance: 2 + rayModeToggling: 0 + mouseRay: 0 + lockableFreeLookComponent: {fileID: 0} + handsComponent: {fileID: 0} + raycastLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + startScreenPosition: {x: 0, y: 0, z: 0} + debug: 0 +--- !u!114 &1016565320 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b8ad317191c930345bb55655eac9a932, type: 3} + m_Name: + m_EditorClassIdentifier: + controller: {fileID: 1016565319} + hands: {fileID: 1016565321} + interactMouseButton: 0 + rayModeChangeMouseButton: 1 + dropKey: 113 + throwKey: 102 + examineKey: 101 + placeKey: 116 +--- !u!114 &1016565321 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ff7c610785ea24144a1af4b97eb2ba39, type: 3} + m_Name: + m_EditorClassIdentifier: + hand: {fileID: 2124761399} + handAimPos: {x: 0, y: 0, z: 0.8} + examinationMouseSensitivity: 1 + smoothTake: 1 + smoothMoveFactor: 0.1 + smoothRotateRate: 10 + throwFromCenter: 1 + throwUpFactor: 0.2 + throwAngularVelocity: 10 + throwTransform: {fileID: 0} + handNoiseGain: 1 + lockableFreeLookComponent: {fileID: 0} + focusEffectComponent: {fileID: 0} + nicePlacement: 0 + disableShadowsOnTakenObjects: 1 +--- !u!114 &1016565322 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e26630301387ce5469cfa0fb478b201b, type: 3} + m_Name: + m_EditorClassIdentifier: + k_Spring: 100 + k_Damper: 10 + k_Drag: 0 + k_AngularDrag: 0 + k_Distance: 0.0001 + k_AttachToCenterOfMass: 0 + distanceLimit: 5 + clampVelocity: 2 + clampExitVelocity: 2 + fakeMass: 0.2 +--- !u!114 &1016565323 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 81363621df3548e45ba871e78efd9d68, type: 3} + m_Name: + m_EditorClassIdentifier: + centerText: {fileID: 0} +--- !u!114 &1016565324 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1016565317} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a5fc4a4111f27864b8128645cf6c82b6, type: 3} + m_Name: + m_EditorClassIdentifier: + springRate: 5 + softClampAngle: 50 --- !u!1 &1100524135 GameObject: m_ObjectHideFlags: 0 @@ -1442,6 +2091,89 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1569438905 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1569438906} + - component: {fileID: 1569438908} + - component: {fileID: 1569438907} + m_Layer: 0 + m_Name: hand_right (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1569438906 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1569438905} + serializedVersion: 2 + m_LocalRotation: {x: -0.5059682, y: 0.48808333, z: 0.49375504, w: 0.5118367} + m_LocalPosition: {x: 0.065, y: 0.002, z: -0.206} + m_LocalScale: {x: 0.17999998, y: 0.18, z: 0.018000007} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2124761399} + m_LocalEulerAnglesHint: {x: -89.339, y: -0.049, z: 87.988} +--- !u!23 &1569438907 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1569438905} + 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: -2894856913260010252, guid: bdea37ec281a49c45ae34b3c72e5c08d, 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} +--- !u!33 &1569438908 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1569438905} + m_Mesh: {fileID: -5163259039384273826, guid: bdea37ec281a49c45ae34b3c72e5c08d, type: 3} --- !u!1 &1757469719 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6124499960613037686, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} @@ -1469,6 +2201,160 @@ MeshCollider: m_Convex: 1 m_CookingOptions: 30 m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1766686977 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1766686978} + - component: {fileID: 1766686981} + - component: {fileID: 1766686980} + - component: {fileID: 1766686979} + m_Layer: 5 + m_Name: RawImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1766686978 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1766686977} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 171556526} + 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: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1766686979 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1766686977} + 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: d3f4a03cbb6c2834cb8d594236317c99, type: 3} + icon_scroll: {fileID: 2800000, guid: d3f4a03cbb6c2834cb8d594236317c99, type: 3} + icon_grab_knob: {fileID: 2800000, guid: d3f4a03cbb6c2834cb8d594236317c99, type: 3} + icon_hold_knob: {fileID: 2800000, guid: d3f4a03cbb6c2834cb8d594236317c99, type: 3} + image: {fileID: 1766686980} +--- !u!114 &1766686980 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1766686977} + 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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + 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!222 &1766686981 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1766686977} + m_CullTransparentMesh: 1 +--- !u!1001 &1776018597 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalPosition.x + value: 13.1 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalPosition.y + value: 1.41 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalPosition.z + value: 7.18 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7169147 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalRotation.x + value: 0.67568386 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalRotation.y + value: -0.11777167 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalRotation.z + value: 0.12495836 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 86.608 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7217391875016474312, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 19.775 + objectReference: {fileID: 0} + - target: {fileID: 8661871210265028242, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + propertyPath: m_Name + value: crate_test (4) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} --- !u!1 &1793071883 GameObject: m_ObjectHideFlags: 0 @@ -1587,11 +2473,70 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0fb5ec34d66e2824c92ed0b720ca13df, type: 3} +--- !u!1 &2014195372 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8661871210265028242, guid: 79b1ab56bfd061d46a689142c3992685, type: 3} + m_PrefabInstance: {fileID: 753003016} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2014195378 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2014195372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cf9152fd8b7951445bef5e6f0778fd53, type: 3} + m_Name: + m_EditorClassIdentifier: + manager: {fileID: 0} + info: + name: + rb: {fileID: 0} + rotateAroundPoint: 0 --- !u!1 &2054939181 stripped GameObject: m_CorrespondingSourceObject: {fileID: 5607609358878881638, guid: cdb590802e3f6bd4db6d5eddce994501, type: 3} m_PrefabInstance: {fileID: 3302050216738139556} m_PrefabAsset: {fileID: 0} +--- !u!4 &2085744658 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4353896453404184, guid: c75e91cf060bbf04e89204fa400606df, type: 3} + m_PrefabInstance: {fileID: 236143043} + m_PrefabAsset: {fileID: 0} +--- !u!1 &2124761398 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2124761399} + m_Layer: 0 + m_Name: Hands + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2124761399 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2124761398} + serializedVersion: 2 + m_LocalRotation: {x: 0.0057716966, y: -0.004608993, z: -0.0000215645, w: -0.99997276} + m_LocalPosition: {x: 0.23, y: -0.45, z: 0.65} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1569438906} + m_Father: {fileID: 1016565318} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &3302050216738139556 PrefabInstance: m_ObjectHideFlags: 0 @@ -1790,6 +2735,11 @@ SceneRoots: - {fileID: 4659057377401208258} - {fileID: 1541156699} - {fileID: 753003016} + - {fileID: 1776018597} - {fileID: 1213413922} - {fileID: 1553748434} - {fileID: 758750041} + - {fileID: 139751029} + - {fileID: 702668100} + - {fileID: 171556526} + - {fileID: 672825092} diff --git a/Assets/Scripts/Interactables.meta b/Assets/Scripts/Interactables.meta new file mode 100644 index 0000000..d1cd7d1 --- /dev/null +++ b/Assets/Scripts/Interactables.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 433e1012444d2b845ba4765ede367e22 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Interactables/InteractableTest.cs b/Assets/Scripts/Interactables/InteractableTest.cs new file mode 100644 index 0000000..edbb37f --- /dev/null +++ b/Assets/Scripts/Interactables/InteractableTest.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Nothke.Interaction; + +public class InteractableTest : Interactable +{ + public override void Use(InteractionController im) + { + base.Use(im); + Debug.Log("works!"); + } +} diff --git a/Assets/Scripts/Interactables/InteractableTest.cs.meta b/Assets/Scripts/Interactables/InteractableTest.cs.meta new file mode 100644 index 0000000..ddb06cc --- /dev/null +++ b/Assets/Scripts/Interactables/InteractableTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 429d0776ebbb12d4e8adc0328a254f36 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SlidingCrane.cs b/Assets/Scripts/SlidingCrane.cs index b4312c3..5bc17d4 100644 --- a/Assets/Scripts/SlidingCrane.cs +++ b/Assets/Scripts/SlidingCrane.cs @@ -11,15 +11,20 @@ public class SlidingCrane : MonoBehaviour public Transform xTransform; public Transform yTransform; + public float yRange = 10; public float xRange = 5; public Transform testTgt; public Vector3 target; + public Rigidbody craneRail ; + private void Start() { target = transform.position; + + } void Update() @@ -30,7 +35,6 @@ public class SlidingCrane : MonoBehaviour Vector3 localTarget = transform.InverseTransformPoint(target); - Vector2 targetPlanar = new Vector2(localTarget.x, localTarget.z); float xTgt = Mathf.InverseLerp(-xRange, xRange, targetPlanar.x); diff --git a/Assets/Textures/hammer.png.meta b/Assets/Textures/hammer.png.meta new file mode 100644 index 0000000..ec07f72 --- /dev/null +++ b/Assets/Textures/hammer.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: fb6bad4174f45d645b4a8e7b6746e030 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 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 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset index 558a017..58b5dc2 100644 --- a/ProjectSettings/TimeManager.asset +++ b/ProjectSettings/TimeManager.asset @@ -3,7 +3,7 @@ --- !u!5 &1 TimeManager: m_ObjectHideFlags: 0 - Fixed Timestep: 0.02 + Fixed Timestep: 0.01 Maximum Allowed Timestep: 0.33333334 m_TimeScale: 1 Maximum Particle Timestep: 0.03