Profile image

Cylinder Grip Interaction and XML

Dev NathanMikeska  2.2 years ago

There are several XML attributes used when interacting with certain parts via mouse or touch inputs. Most parts that can use these have reasonable default values and work right out of the box. Cylinder grips however are a very generic part and have no default values for interaction, as they depend on the configuration of the control base they are connected to.

These XML attributes apply to PosedGrip modifiers:
screenXPositionAxisMap - Vector3
screenYPositionAxisMap - Vector3
screenXRotationAxisMap - Vector3
screenYRotationAxisMap - Vector3
screenAxisSize - Vector2
screenAxisDeadzone - Vector2

The axis map attributes are comma separated float values, typically ranging from zero to one that define a mask for inputs that are applied to the associated ControlBase modifier.

An easier way to look at it though is an AxisMap attribute value should match its associated ControlBase axis value. If a ControlBase is using a RotationAxis, match its axis value with a screenXRotationAxisMap or screenYRotationAxisMap. If a ControlBase is using a PositionAxis, match its axis value with a screenXPositionAxisMap or screenYPositionAxisMap.

Gator Example with unrelated XML removed:

<Part id="1190" partType="ControlBase-Joystick-1">
<ControlBase.State>
<RotationAxis axis="1,0,0" input="Throttle"/>
</ControlBase.State>
</Part>
<Part id="1193" partType="Grip-Test-1">
<PosedGrip.State screenYRotationAxisMap="1,0,0" tooltip="Collective" />
</Part>

In the above example, the control base on the collective controlling the throttle uses a RotationAxis on axis "1,0,0". To interact with that, we can use a screenXRotationAxisMap or a screenYRotationAxisMap with a value of "1,0,0" to match the ControlBase rotation axis.

The screenAxisSize is 2 comma separated floating point values that represent a percentage of screen space that define the 0 to 1 (or -1) range of the axis. The screenAxisDeadzone is the same thing, only it defines the deadzone for the axis.

Take screenAxisSize="0.2,0.4" with a screen resolution of 1000x1000 for example... This means that when you click on the part to interact with it, then drag the part left (for an X screen axis) or down (for a Y screen axis), the input changes from zero to -0.5 at 100 pixels and to -1 at 200 pixels. Likewise, dragging it up or right, it would reach an input of 0.5 at 200 pixels and 1.0 at 400 pixels.

  • Log in to leave a comment
  • Profile image
    60 BG27

    After reverse engineering and trial and error I was able to understand

    4 months ago
  • Profile image
    0 Eeeeaa

    My brain can't comprehend this info

    4 months ago
  • Profile image
    7,502 TTL

    Tak q fancy maigc min

    +1 1.2 years ago
  • Profile image

    This is a little of topic but it seems that nobody know the answer to this question, in VR if you attach a gripable peice to another peice(say a bomb) would you be able to move the grip peice and the other piece move with it

    +1 2.2 years ago
  • Profile image
    7,177 Bellcat

    Can you at least put the codes into a codeblock, using 3 back ticks each in the front and the end, as in the markdown formatting tutorial, so the spaces will be shown so I can read better? Thanks.

    +1 2.2 years ago
  • Profile image
    3,611 Dathcha

    I like your funny words magic man

    +7 2.2 years ago
  • Profile image

    I wish you could save forum posts to view later, like this one

    +5 2.2 years ago
  • Profile image
    92.7k MisterT

    Thanks, amazing !

    +2 2.2 years ago
  • Profile image
    29.4k Nerfaddict

    I don't now what any of this means, but cool

    +20 2.2 years ago