|Name of gadget||Piston|
|Number of Tweak pages||1 (of 4 linear connector types)|
|Last updated||27 June 2019 [EA v1.04]|
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:
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)
- Stamp a shape into your scene. This will be the parent.
- Stamp another shape into your scene as a new sculpture. This will be the child.
- Pick a piston from the gadget menu.
- Connect the piston from the parent shape to the child.
- Stamp a light into the scene.
- Open the tweak menu for the piston.
- Connect the “connector completion” output to the light’s power port.
- 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.
- 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.
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
- 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.
- 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.
- 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.
- 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).
- 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.
- 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.
- 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).
- 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.
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. If 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.
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):
(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.