Logic Gadgets: Piston

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

Description

The Piston connector is one of the connector types that you can use to create a dynamic connection between two sculptures. When you use one to connect a “parent” sculpture to a “child” sculpture you create a link between the two that limits the child’s movement relative to the parent along a straight line, with a maximum and minimum length and no scope for rotation.

Once 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 piston 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:

Piston connector

In this respect it is very similar to the slider connector. However, unlike the slider, the piston is a powered connector and is capable of moving the child towards and away from the parent (by default it moves in-out-in-out in a regular cycle). As such it is a good way of creating dynamic elements that move back and forth, like moving platforms. With simple logic, pistons can also be set to move to any position along their length at any time.

One important difference between using a connector and an alternative animation technique such as keyframes is that the piston is subject to the physics of a Scene, giving it a natural “springiness” that can be exploited to make things look more realistic – for example, you could make platforms that spring slightly (or a lot!) when a large weight – a puppet for example – lands on them.

Example Tutorial (adapted from Media Molecule)

  1. Stamp a shape into your scene. This will be the parent.
  2. Stamp another shape into your scene as a new sculpture. This will be the child.
  3. Pick a piston from the gadget menu.
  4. Connect the piston from the parent shape to the child.
  5. Stamp a light into the scene.
  6. Open the tweak menu for the piston.
  7. Connect the “connector completion” output to the light’s power port.
  8. Start time.

Watch the piston move back and forth rapidly, moving the child relative to the parent. As it moves the light fades on and off with the piston’s rhythm – the “connector completion” output’s signal represents how far along its cycle the connector is and is often a useful way to trigger events in your scenes.

Tweak Menus

Piston 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. Cycles per Minute
    6a. Input
    6b. Output
  7. Motor Strength
    7a. Input
    7b. Output
  8. Reverse Direction
    8a. Input
    8b. Output
  9. Connector Position
    9a. Input
  10. Connector Completion
    10b. Output
  11. 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 piston’s tightness setting is a measure of how much resistance it has to movement along its length. At 0% there is no resistance; at 100% it is almost impossible to budge. The ideal setting depends on the motor strength. Even at a motor strength of 100%, a tightness of over 90% is likely to inhibit the piston’s motor
  3. Min Length
    Define the minimum length of the piston – 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 piston – 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 piston 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, which disrupts the movement of the piston.
  6. Cycles per Minute
    Use this to define the speed with which the piston moves. When it is cycling back and forth, one cycle is the time taken to go from longest to shortest and back to longest positions again. If you are using the piston to push or pull a child object to a particular position, this will affect the speed with which it does so (in combination with motor strength and tightness).
  7. Motor Strength
    Use this to define the power with which the piston moves back and forth. In combination with tightness, this determines the ability of the piston to do its job. For example by balancing these settings it is possible to make a piston that has enough strength to raise a platform into a higher position when it is empty but slides back to a low position when enough weight is added to it or if it is dragged down by the imp. This could be the basis of a physics-based pressure plate.
  8. Reverse Direction
    Use this to switch the direction that the piston is moving – obviously this is more noticeable if the piston is part-way between longest and shortest positions. By default a piston starts its cycle by pushing out to its maximum length (if it can); when reversed, it starts by pulling in to its minimum length.
  9. Connector Position
    Input a value into this tweak to tell the piston to adopt a particular length. Use values from 0 (minimum length position) to 1 (maximum length). With an input here, the piston will no longer move automatically back and forth; it will instead obey this input. Note that – at present – when the “reverse direction” toggle is active, this value will need to be negative (from 0 to -1).
  10. Connector Completion
    This output provides a value from 0 to 1 as the piston moves from its minimum length to maximum length positions. Use this to find out exactly how far the piston is stretched, for example to trigger an output if you use a piston as a pressure pad.
  11. Power
    The power input for the piston retains the connection but disables the outputs. It also affects the tightness and motor activity. When powered off, the tightness is effectively zero and the piston won’t offer any resistance. Although the “motor” will still hold the piston in its last position if it is strong enough, it will not attempt to move at all while powered off (with the possible exception being if you tweak the motor strength while it is powered off). If a piston is cycling back and forth, switching off the power will remember the current direction, so will continue in the same direction when switched back on.
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 pistons 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

Advertisements

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: