Interactor’s main script and used on the player’s itself. For now, there should be only one Interactor in the same scene. It runs an update loop for all of its effector in FixedUpdate to check their states for interaction object’s children targets. And sends interaction start calls for InteractorObject & IK components. Has some main options for Interactor and all effector settings.
Logo - If you click on the logo, it will minimize and give you more space on Inspector.
Right Top Buttons - These are shortcuts for documentation, forum thread, sending a message to me and the store page. All of them have descriptions of them as a tip. These buttons disappear with the minimized logo.
Effector Tabs - Every effector has it’s own settings. You’ll see selected effector’s gizmo on SceneView. You can add, delete, copy these settings and paste them onto another effector. Also, you can enable (Green) and disable (Red) effector on the power button. A disabled effector won’t work as it never exists.
Name - You can give any names for your effectors. If you leave blanks between the words you gave, they will get proper line positions on effector tab buttons. Long words will stay center aligned.
Effector Type - Interactor has player parts for a biped humanoid by default. If you want to change these types, you can add your own effector types by coding. See scripting API for more information.
Effector Position - Effector’s position offset for added sphere trigger’s center. (0, 0, 0) position means it’s on the center of the sphere. Position values can’t go out of the sphere radius because Interactor checks only the targets inside this trigger. Also, effector can’t get close edges within its own range distance. It will automatically arrange itself around the trigger edges if you push it more. See Effector Range Distance.
Horizontal Angle - Effector’s horizontal angle value. Interaction object’s targets should be in these angles to be positive. You can see angle values on SceneView gizmo with white small texts.
Horizontal Offset - Set horizontal angles in any horizontal direction. It shows the middle with a thick white line on SceneView.
Vertical Angle - Same for the vertical axis.
Vertical Offset - Same for the vertical axis.
Effector Range Distance - Effector’s range to start an interaction. It can’t be bigger than the sphere trigger because it makes no sense. If the effector’s range touches the sphere trigger’s edges, it will be pushed to center to fit inside automatically. This value as another sphere inside the sphere trigger. If the effector position won’t move closer to the edges, it means it’s edge touches the edge on somewhere. And it will slide over the edge if you try to move.
These settings work only for this effector. Every effector has it’s own rules. You can copy these settings with Copy Button and paste them onto another effector to set its values easier.
>Spawner Window - Opens InteractorTargetSpawner window. Also on Window>Interactor>Interactor Spawner Window opens too.
Self Interaction - If you wish to use self interactions, you should assign the parent object here. More info on Interaction Types > Self Interaction.
Gizmo Opacity - Set SceneView gizmo’s opacity value.
Raycast Distance - Distance interaction range. Distance type objects can be interacted by crosshair within this range. Raycast will shoot only this long.
Codes - Shortcuts for opening Interactor effector loop in the main script or to expose more properties on the inspector in the editor script. So you can easily open main and editor scripts from here.
Debug View - Main switch for turning on and off SceneView gizmos. Interactor gizmos stay on SceneView as long as the debug switch turned on, even Interactor object won’t be selected. So you can work easier.
InteractorTargetSpawner is the prefab holder window and saves those prefab lists in specified project folder as ScriptableObject. Saves are called as SaveData and can be used for different setups. For example, you can create a SaveData for a specific need and change save file temporarily with some other SaveData to switch back later. Active SaveData showed at the top of the window and can be replaced by any time. But you always need a SaveData to use Spawner window & SceneView right click menu. When you add your first effectors to the Interactor, you will be asked for creating one. Don’t forget, when you close a SaveData by clicking red X button, data will be saved as it is before closing it down.
Also you’ll see all the effectors you have on Interactor. If you want to add more than one prefab for each effector tab, you need to attach main prefab first. Then you can add other prefabs all together by dragging them into the drag area (No need to worry about repetitive ones, it will automatically check for duplicates). You can remove any of them by clicking its red X button. If you want to remove all prefabs, just remove the main prefab, it will wipe out the list.
Spawner window has some options for the designing stage. Once you have prefabs on it, SceneView right click menu will be activated. Just select any prefab you want and it will be spawned as a child of that gameobject, on that clicked spot. You have four rotation modes for the spawning. Default prefab rotation, surface normal rotation, SceneView camera direction and SceneView camera direction for Y-axis only.
Exclude Player layer on raycasts - This will ignore player’s triggers and colliders when raycasting in SceneView. Otherwise, it could become quite annoying while working around the player gameobject because it can spawn target prefabs on Interactor’s trigger.
Add required components - If enabled, InteractorObject component will be added to selected object(If it has not yet) when targets spawned. And interaction type will be set as Manual Button for a quick test run.
Right click time (ms) - The maximum time needs to pass before not moving the mouse cursor when right clicked in milliseconds. If you move mouse cursor after this time passed, right click menu won’t show up. To prevent conflicts for default SceneView right click behaviour since it’s used for the camera rotation. If you’re slow clicker, set higher values and vice versa.
Besides of the right click menu, also Interactor Effector window on SceneView gets enabled by opening the InteractorTargetSpawner window. You’ll see an Interactor toggle button on top left corner of the SceneView when Spawner window opened. That toggle activates the Effector Settings menu on SceneView. Spawner window doesn’t need to be seen all the time, just put it on any editor tab to keep the Effector Settings menu enabled. Once you close Spawner window, Effector Settings menu will also close down, except the full screen mode.
InteractorIK is based on Unity’s IK and right now works just for hands & feet. It works as Two Bone IK system, which means if you move the hand, it will rotate it’s forearm & arm accordingly. But it won’t move or rotate further into the body. Final IK is Full Body IK system so it can pull or push other bones too.
IK Parts should be a maximum of 5 elements because it has only 5 part types right now. Set each element’s part type.
Weight - Shows this IK part’s current weight. It’s just for debugging.
Rotation - Bone’s rotation should be set as well as the position? If disabled, only the position will be set to target’s.
Target Transform - Shows this ik part’s current target. Debugging purposes.
Duration - Duration for each interaction in total. 2 seconds means 1 second for reaching the target, 1 second for returning to the default position.
Multiplier For Second Half - Multiplier for returning phase. If you set this to 0.5f then instead of 1 second, it will move twice in 0.5 seconds. So total interaction duration will become 1.5 seconds. Only the second part will be affected.
Match Children Bones - If you want to match all bone rotations activate this. A hand needs to match it’s children bone rotations to get the same exact pose of its target.
InteractorObject is the main component for interaction objects (besides Final IK’s InteractionObject for Final IK version). It will evolve in upcoming updates but for now, it handles all interaction types. Some settings may not exist in both versions (InteractorIK & Final IK).
Interaction - Interaction type, if you don’t choose anything this field will be highlighted with red color. For more information about the interactions see InteractionTypes section.
Pause On Interaction - Select if you want body parts to stay on target when interacted (like touching or holding an object). Otherwise, IK parts will return to their initial position when reached to target.
Interruptible - Select if interaction can be interrupted by another interaction. Same body part can’t leave the uninterruptible interaction and start a new one.
Ease Type - Rate of change of velocity/time for IK animation. This will be changed with animation curves for more freedom in upcoming updates. For now, you can see a great cheat sheet for used curve types here.
Z Only - Deactivates effector check for Y-axis. So the interaction object’s target height won’t matter. Useful for ground objects for picking them up.
Default Animated Distance - Activation range for Default Distance type interaction. Automatically opening truck doors for example, they won’t work if this condition has not met.
Object Raycast - Interaction object’s target will be checked once with raycast before starting interaction to be sure there is no obstacle between the effector & the object. Useful for doors at downstairs or upstairs.
Other Targets Root - If some of the target children are not parented by this object, you can select the other parent that has them all.
Pivot - Buffer object between the interaction object and its targets to rotate them towards to effector when interacted. Pivot objects are important, especially for buttons. Pivot calculation activates automatically when any object assigned to this property.
Pivot X, Y, Z - Deselect if you don’t want pivot to rotate any of these axes.
Outline Mat - If Outline material (with Outline shader) is this object’s material, leave empty. If it is another object, assign here.
Touch Height - Height setting for Touch Vertical interaction (Touching walls, etc).
Touch Forward - Forward offset for Touch Vertical interaction.
Touch Rotation - Rotation offset for Touch Vertical target.
Touch Ray Length - Touch Vertical works with raycast to detect its wall. This is useful to adjust ray’s length to prevent it from hitting too far with low angles.
Touch Lerp - Lerping target position between wall and effector to make fine adjustments in some cases.
Touch V Cooldown - Time needs to be passed for Touch Vertical interaction to start. Instant interactions can look bad because the IK part will try to interact constantly.
Touch Horizontal Forward - Forward offset for Touch Horizontal Up target.
Touch Horizontal Right - Left/Right offset for Touch Horizontal Up target.
Touch Horizontal Ray Length - Touch Horizontal raycast distance.
Touch H Cooldown - Time needs to be passed for Touch Horizontal Up interaction to start.
Two Hands Closer - Lerp between Pickable TwoHands targets between object center and player position (since pick up objects mostly stay on the ground while the player position is on the ground too).
Hold Point - Assign a hold point which should located under the player gameobject as a child. Needed for Pickable TwoHands interaction.
Info - Just for example scenes but could be useful. Text mesh object slot for interaction object for activating/deactivating while being interactable and not. Also instead of texts, any type of gameobject works the same (activates/deactivates) if assigned here.
Unity Event - You can create Unity Events for almost every interaction type. When interacted, these events will be called.
InteractorTarget is a target script for responsible of showing gizmos of bones and registering themselves to parent InteractorObject as a target. It has Effector Type settings to tell Interactor which effector’s target when interacted with its parent object. Also has override settings to override the effector’s own rules. It’s just for the range now but angles and other offsets will be included to be overridden in upcoming updates.
The second theme is for changing color themes for target bone gizmos to see better in some cases when background colors are similar.
InteractorTarget is exclusive for InteractorIK. To override effector rules, you can use InteractorOverride component for Final IK.
InteractorOverride is exclusive for Final IK version to override some effector settings for that specific target. It’s useful when you set the effector’s range for 0.5 but want some objects to be interactable with more or less distance. Other effector settings will be added in upcoming updates.
BasicUI written just for example scenes to show Interaction selection with UI and inputs. Also enables a crosshair on GUI. When added in the scene, all interactions in the trigger will be showed and will be selectable to interact except Self Interactions. If selected & used interaction is not useable at that position, list selection will be reset. BasicUI can be added to any scene object.
BasicInput & BasicInputInteract
BasicInputs are modified Unity Standart Asset input classes and should be on player gameobject. It will handle inputs and send them to Interactor when pressed. Interactor will decide if that call will start an interaction or not depending on effector checks.
All properties are for just debugging purposes.
PlayerController taken from Standart Assets and modified more than mildly. It handles entering/exiting vehicles, extra move abilities and climbing. It has a default setting on it.
PlayerState will be removed in newer versions of the Interactor. Right now some information about the player passed through here between BasicInput, Interactor, Vehicles and PlayerController because it’s a singleton and easily accessible from any class. It holds states of the player.
This is a regular camera script to control third-person camera. It’s a bit modified to lock the cursor with right click easily. And also has a tiny method for locking Y-axis when interacting with rotators.
VehicleBasicInput & BikeBasicInput
Basic Standart Asset scripts for vehicle input. The vehicle has some extra methods for controlling its windshield & back door animations.
VehicleController & BikeController
Mildly modified Standart Asset vehicle scripts. The vehicle has accelAmount and steerAmount for Pedals and SteeringWheel to tell their rotating amounts. The bike has a method for pedals to look always up when rotating with front wheel on FixedUpdate().
VehiclePartControls is for vehicle animation examples and gets every interaction object on the vehicle and caches their animation strings as ids then store them on their InteractorObject classes to use later when interacted. If that part has an animation state on the vehicle’s animator, then it will activate their animations when interacted. Some animations like Elevator, Back door and windshield have their animation events on their animation files to automatically deactivate themselves.
ProtoTruck example scene has turrets to show a non-human player example. Turrets and their lights aim to their targets with different speeds and fire in this script. Also shot targets get their push force from here.
Pedal rotation class gets accelAmount from VehicleController for rotation amount. Both pedals have it.
Steering wheel rotation class gets steerAmount from VehicleController for rotation amount. So when rotating the vehicle, the steering wheel rotates accordingly with set limits.
Handler class for Manual Hit interaction. It rotates itself when enters the player sphere, repositions its target for a hit position(pulling hand back), moves the target back to original position on the object and deals force when hit happens. It works like pivots and positioned between target and object as a buffer object in the hierarchy.
Hit Obj - InteractorObject for hit interaction.
Y Offset - Height of the target for pullback reposition.
Distance Percentage - Lerp between the initial target position and pull back position.
Angle - Angle between the initial target’s position and effector’s position.
Hit Force - The force to be applied when hit by body part to target’s parent (InteractorObject).
This is a really useful class for spawning prefabs from a determined place randomly in the scene on runtime. Also pools the prefabs on start for maximum performance. Set its sizes with transform scale and pooled prefabs will be randomly spawned in that boundaries. They can be spawned by pressing the Enter key or calling SetPooledPrefabActive(int count) method in script or events with count to spawn per call. Gizmo will show the spawn area and prefab array is for prefabs to spawn. Max prefab count is pool count and that amount of object will be pooled on start.
Very basic on off script for setting assigned gameobjects active or inactive. It has an array for gameobjects and Toggle() script for calling from code or events.
Sets Text Mesh values with a prefix, multiplication and determined decimals. It is used for the console terminal’s digital frame to show graph values.
Rotator class is for rotating interacted objects with mouse Y input. It has settings for adjusting the rotation amount and style. Console rotators and Gumball crank uses this to showcase more interactable ways in example scene. Set the direction and it will rotate constantly with given settings during interaction time with mouse Y input. Will be improved on upcoming updates.
Switch is also rotating objects when interacted but also can change positions too. It works one time when interacted, unlike rotators. It has its own events and you can add more than two events for each use and it will cycle these events. So this way you can have more complex animations on the object. It is used for OnOffButton and WaveTypeButton on the console in the example scene.
Uses LineRenderer to draw mathematical functions like Sine, Square and Triangle wave types.
Used for changing rotation & position values with determined duration and ease type. The ability for tweening targets in runtime creates a new set of possibilities while interacting objects. This class will be improved on upcoming updates to create more easy and customizable movements.
A bit different version of AutoMover with multiple points to loop for the position. It is used for Self Interaction targets and has an odd property to set it’s happening chance.