Snap and Plug - v2.2
SnapAndPlug Namespace Reference

Detailed Description

SnapAndPlug (SnP) is available on the Unity Asset Store at: https://www.assetstore.unity3d.com/#!/content/21930

This is the API for SnP - Most users will never need this, it's mostly used by people who want to heavily customise the internals of SnP, or create proprietary in-game snapping systems.

The core classes you need to understand are:

For in-game snapping, the main class you need to use is:

  • DragDropAction3D - complex class that stores all the data for 3D in-game snapping frame-to-frame and does live update

Everything else should only be needed when using one or more of the methods in the above classes, and should be obvious from context what it is used for.

Classes

class  DragDropAction3D
 Powerful class that implements in-game/play-mode snapping in a modular, re-usable, extensible fashion. More...
 
interface  IDragActionSource
 Used by DragDropAction3D to give callbacks to the object that is being dragged. More...
 
interface  ISnapObject
 This interface unifies SnapGroup and SnapPiece as "things that the user can snap together"; there are few places in the code where it is cleaner to accept either a piece or a group interchangeably. More...
 
class  PhysicsConfigurableJoint
 Complete recreation of Unity3D's ConfigurableJoint as a SnapJoint: if you use this joint on a SnapSocket, snapping that socket to anything will create a Unity3D ConfigurableJoint in the game at the point of snapping, and attach the two SnapPiece objects using the Unity joint. More...
 
class  PhysicsFixedJoint
 Complete recreation of Unity3D's FixedJoint as a SnapJoint: if you use this joint on a SnapSocket, snapping that socket to anything will create a Unity3D FixedJoint in the game at the point of snapping, and attach the two SnapPiece objects using the Unity joint. More...
 
class  PhysicsHingeJoint
 Complete recreation of Unity3D's HingeJoint as a SnapJoint: if you use this joint on a SnapSocket, snapping that socket to anything will create a Unity3D HingeJoint in the game at the point of snapping, and attach the two SnapPiece objects using the Unity joint. More...
 
class  PhysicsSpringJoint
 Complete recreation of Unity3D's SpringJoint as a SnapJoint: if you use this joint on a SnapSocket, snapping that socket to anything will create a Unity3D SpringJoint in the game at the point of snapping, and attach the two SnapPiece objects using the Unity joint. More...
 
class  SelfMatchingJoint
 This Joint will only ever let SnapSocket's connect if BOTH of them are using this exact SnapJoint. More...
 
class  SnapAndPlugScene
 Because Unity3D doesn't yet support per-scene configuration data for 3rd party plugins, this object is automatically created and inserted into each Scene that is using SnapAndPlug. More...
 
class  SnapFixUnityBugs
 Workarounds for temporary Unity3D bugs live in this class as class extensions.
 
class  SnapGizmoExtensions
 Extra features that are missing from Unity3D's Gizmos APIs but which we need in order to draw decent scene-view graphics and GUI. More...
 
class  SnapGroup
 Whenever you snap things together, they are placed into a SnapGroup, enabling Unity3D to treat them as a single object - moving one moves all of them, rotating one rotates all of them - etc. More...
 
class  SnapJoint
 SnapJoint's control which SnapSocket's can connect to each other; the most basic joint (UniversalJoint) always allows any other joint-type (and it's socket) to connect. More...
 
class  SnapPiece
 Attach a SnapPiece to any in-game object that you want to be able to snap to things. More...
 
class  SnapSocket
 SnapSocket's are the "snappable" part: you attach one of these to every point on your SnapPiece that you want to snap to other SnapPiece's. More...
 
struct  TransformDelta
 Stores rotation + translation in LOCAL co-ordinates as a single struct for when we need to pair these in internal operations. More...
 
struct  UnityCloneJointDrive
 Stores all the data of a Unity3D JointDrive struct, so that we can auto-create one when the Joint is snapped. More...
 
struct  UnityCloneJointLimits
 Stores all the data of a Unity3D JointLimits struct, so that we can auto-create one when the Joint is snapped. More...
 
struct  UnityCloneJointMotor
 Stores all the data of a Unity3D JointMotor struct, so that we can auto-create one when the Joint is snapped. More...
 
struct  UnityCloneJointSpring
 Stores all the data of a Unity3D JointSpring struct, so that we can auto-create one when the Joint is snapped. More...
 
struct  UnityCloneSoftJointLimit
 Stores all the data of a Unity3D SoftJointLimit struct, so that we can auto-create one when the Joint is snapped. More...
 
struct  UnityCloneSoftJointLimitSpring
 Stores all the data of a Unity3D SoftJointLimitSpring struct, so that we can auto-create one when the Joint is snapped. More...
 
class  UniversalJoint
 
struct  Version
 

Enumerations

enum  DragDropSnapMode { DragDropSnapMode.METERS_3D, DragDropSnapMode.PIXELS_2D }
 Specifies whether Snap tolerance (how close two things must be before snapping) is measured in 3D or 2D. More...
 
enum  ShowConnectedSocketsMode { ShowConnectedSocketsMode.OnlyWhenSelected, ShowConnectedSocketsMode.Always, ShowConnectedSocketsMode.Never }
 

Enumeration Type Documentation

◆ DragDropSnapMode

Specifies whether Snap tolerance (how close two things must be before snapping) is measured in 3D or 2D.

Enumerator
METERS_3D 

Snap tolerance is in Unity3D world space, i.e.

meters

PIXELS_2D 

Snap tolerance is in 2D, i.e.

screen pixels

◆ ShowConnectedSocketsMode

Enumerator
OnlyWhenSelected 

Connections only appear in Scene view when the SnapGroup is selected in the Unity Hierarchy window.

Always 

Connections always appear in scene view.

Never 

Connections never appear in scene view.