Sockets are a mechanism for connecting two or more objects into one. In the library window they are depicted as follows

The package includes two objects:

  1. Connection point (plug)
  2. A connection point (socket)

Connection is made by connecting the plug object to the socket object

List of chapters

Using

To use the mechanism to connect two objects, it is necessary to place both objects in a hierarchy of objects to be connected. As an example we took a cube and a pyramid

After creating the objects in the scene, you must also create two objects - a connection point (plug) and a connection point (socket). They must also be placed in the hierarchy of objects to be connected

After creating the objects in the scene, you must also create two objects - a connection point (plug) and a connection point (socket). They must also be placed in the hierarchy of objects to be connected

  1. Can be disconnected - the field responsible for the possibility to disconnect dots after joining

  2. Can connect - the field responsible for the possibility to connect the points

  3. Connection key - the keyword that must be the same on two points for a possible connection

Each of the points contains its own settings. The connected point (fork) has the following fields:

  1. Can connect - the field that is responsible for the possibility of connecting points

  2. Connection key - the keyword that must be the same on the two points for a possible connection

After the parent objects have been enabled for handholding you can try to connect the objects

 

Bringing objects to each other

Connection after releasing the pyramid

It is also possible to add many connection points to an object

Blockly

Each of the objects has its own logic. It is necessary to regulate the interaction of points and create a scenario with these interactions

Connecting point (plug)

The connected point contains the following set of blocks:

Logic

  • Can disconnected - returns "true" if the disconnect option flag is set
  • Possible to connect - returns "true" if the connectivity flag is set
  • Is connected - returns true if a point is connected to another point

Actions

  • Connected to - allows you to connect an object to another object
  • Connect with animation plug point OBJECT with time T - allows you to connect an object to another object in a specified amount of time. During this time, the object slowly moves towards the target object and connects
  • Set on grab disconnected true/false - this block defines the possibility of disconnection when holding the object in your hand
  • Disconnect - disconnects the connected point when executed
  • Set possible to connect true/false - specifies the ability to connect to another point

Events


  • On connect - event is called on connection. The Point argument contains the object whose point was connected
  • On disconnect - event is called at disconnection. The Point argument contains an object whose point was disconnected
  • On preview show - event is called when a preview appears. The Point argument contains an object whose point has been brought up to the given
  • On preview hide - event is called when the preview is hidden. The Point argument contains an object whose point was brought to the preview

Connection point (socket)

The connection point contains the following set of blocks:

Logic


  • Possible to connect - returns "true" if the connectivity flag is set
  • Is connected - returns "true" if a point is connected to another point

Actions

  • Connect to OBJECT - allows you to connect an object to another object
  • Connect with animation plug point OBJECT time T - allows you to connect an object to another object in a specified amount of time. During this time, the object slowly moves towards the target object and connects
  • Display preview of fork OBJECT - allows you to show a prototype of the object to be connected
  • Hide for preview - allows you to hide a prototype
  • Display a preview of the most suitable fork - lets you display a prototype of the most suitable object
  • Disconnect - this block disconnects the connected point when it is executed
  • Set possible to connect true/false - enables connection to another point

Events

  • On connect - event is called on connection. The Point argument contains the object whose point was connected
  • On disconnect - event is called at disconnection. The Point argument contains an object whose point was disconnected
  • On preview show - event is called when a preview appears. The Point argument contains an object whose point has been brought up to the given
  • On preview hide - event is called when the preview is hidden. The Point argument contains an object whose point was brought to the preview