Logic Gadgets: Slider

Icon slider
Name of gadget Slider
Section Connectors
Number of Tweak pages 1 (of 4 linear connector types)
Author LadylexUK, QuietlyWrong
Last updated 27 June 2019 [EA v1.04]

Description

A Slider connector allows you to connect two objects, the “parent” and the “child” in a way that holds the child to the parent but allows some degree of movement between them. In the case of the slider, the movement that it allows is towards and away with no rotation. The slider has a maximum and minimum length so the distance between the objects is changeable but constrained.

You might, for example, make a drawer for a desk that the player can open and close by grabbing it with the imp. In that case you would fix the “parent” end of the slider to the rear of the desk’s frame (the relatively stationary part) and the “child” end to the drawer. By tweaking the slider’s settings you can define how stiffly it moves, and the limits of its movement. You can even get an output from the slider to tell your game logic whether the drawer has been left open or closed.

Once the slider is in place, you can can grab the parent to move the connected items as a whole. You can also grab the gizmos at the ends of the connector and reposition these – once they have been assigned to the parent and child objects they don’t even have to be touching those targets! When the slider itself is selected, yellow and blue slider gizmos appear at its ends – you can drag these to change the start and end position of the connector:

Slider connector

The slider has no power to move the child object itself, only to connect the parent to the child with minimum and maximum distances and, through its tightness setting, to offer resistance to that motion. If you need a “powered” connector that can move the child relative to the parent, check out the piston connector.

Example Tutorial (adapted from Media Molecule)

Let’s make a lamp that is controlled by a slider control like a dimmer switch.

  1. Stamp a shape into your scene. This will be the parent object.
  2. Stamp a new shape into your scene. This will be the child object, the light control.
  3. Get a slider connector and use it to connect the parent to the child.
  4. Open the child object’s tweak menu.
  5. Change the child object’s “imp interaction” tweak, setting it to “grab”.
  6. Stamp a light into the scene.
  7. Open the slider’s tweak menu.
  8. Connect the slider’s “connector completion” output to the light’s power port.
  9. Now grab the child shape and drag it back and forth to control the brightness of the light!

Tweak Menus

Slider tweaks
  1. Connector Type
  2. Tightness
    2a. Input
    2b. Output
  3. Min Length
    3a. Input
    3b. Output
  4. Max Length
    4a. Input
    4b. Output
  5. Collide with Connected
    5a. Input
    5b. Output
  6. Connector Completion
    6b. Output
  7. Power
  1. Connector Type
    Here you can change the type of linear connector without having to create a new one; the same connection points between parent and child will be maintained.

  2. Tightness
    The slider’s tightness setting is a measure of how much resistance it has to movement along its length. At 0% there is no resistance from the connector itself; at 100% it is just about impossible to change its length.
  3. Min Length
    Define the minimum length of the slider – the shortest distance that can be adopted between its parent and child gizmos. By default this is zero.
  4. Max Length
    Define the maximum length of the slider – the furthest distance that can be adopted between its parent and child gizmos. By default this is the distance between the parent and child at the time the slider was created.
  5. Collide with Connected
    Toggle this to permit or prevent collisions between the child and parent objects when they come together. When this is switched off, the child and parent will pass through each other regardless of their respective collision settings. When switched on, the objects will behave as normal – colliding if they are configured to do so.
  6. Connector Completion
    This output provides a value from 0 to 1 as the slider moves from its minimum length to maximum length positions. Use this to find out exactly how far the slider is stretched, for example to control the volume governed by a fader on an audio mixing console.
  7. Power
    The power input for the slider retains the connection but disables the outputs. It also reduces the tightness to 0%.

 

Connectors – common properties (click arrow to reveal)

All connectors are completely invisible in play mode. Even the appearance of the connector in edit mode will depend on the current “Show/Hide” settings (there is a specific option for connectors) or whether you’re working on it now. Similarly the “connector” itself has no physicality. So if you want a connection to appear in your scene, or for objects to bounce off it (for example) you will have to create a separate decorative element in addition to the gadget itself.

With all connectors it is important to connect the two sculptures in the right order – connect the (larger yellow) gizmo to the parent first, then (the smaller blue gizmo) to the child. The actual position of the gizmos is normally less important (excepting the cases of string and elastic) and can easily be tweaked once the connection is made. In any case, for sliders the orientation and length of the connection are all that matters. Flip Selected ConnectorsIf you need a quick way to switch the parent and child relationship, select the connector and click on the “Flip Selected Connectors” icon in the context menu.

When placing the parent and child gizmos you should try to avoid getting into the mindset of “realistic” placement. For instance it can be tempting to connect (let’s say while using a bolt to make a hinge) the inside edge of a door to the closest part of the frame that it will be next to when closed, but this is actually unnecessarily fiddly and can make it tough to adjust your connector afterwards. The gadget itself has no physical presence, its “arms” can pass all the way through its targets so it makes no difference if you connect the bolt from the middle of the adjacent wall to the middle of the door. Only the position of the pivot gizmo matters and it helps if the parent and child gizmos aren’t in its way.

When you complete the connection you’ll find that, even in edit mode, the imp can no longer move the child in an unconstrained way – it is limited by the connector’s range. Instead you have to move the parent itself and the child will follow.

If you want to move the child independently, hover the imp tip over the child object and press the triangle button (“Reposition connectors”) on your controller. In this mode the ends of the connector will start glowing and you’ll be able to reposition the child object freely. Press circle to exit this mode.

Reposition connectors

Never connect two sculptures with multiple connectors. Similarly, never make connections in a loop. Such connections are considered invalid in Dreams and will behave unpredictably, if at all (and may even affect your Scene’s performance). When invalid connections are made, the whole connector will turn blue to highlight it (see in the red ovals added to the image here):

Invalid connectors

(This also calls back to the message about not making your connectors “realistic” – if you were hinging a door to a frame, you should use only one bolt where the “realistic” approach might tempt you to use two or more – which would not work properly. You only need one bolt connector and as many visual hinges as you need.)

Connectors only work with sculptures. To connect paintings you have to cheat a little and include an invisible sculpture in a group with the painting. Then the connector can be attached to the group.

 

Lex Tips

Useful Tutorials

Comments and Feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: