Class

SubspacePlaceable.SubspacePlacementScope

Receiver scope that permits explicit placement of a SubspacePlaceable.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public abstract class SubspacePlacementScope

Receiver scope that permits explicit placement of a SubspacePlaceable.

Functions

place

public fun SubspacePlaceable.place(pose: Pose)

Place a SubspacePlaceable at the Pose in its parent's coordinate system.

Parameters

pose The pose of the layout.

placeRelative

public fun SubspacePlaceable.placeRelative(pose: Pose)

Place a SubspacePlaceable at the Pose in its parent's coordinate system with auto mirrored position along YZ plane if parent layout direction is LayoutDirection.Rtl.

If the parentLayoutDirection is LayoutDirection.Rtl, this function calculates a new pose by mirroring the original pose across the YZ plane. This ensures that layouts designed for LTR behave intuitively when the locale is switched to RTL.

The mirroring transformation involves:

  1. Translation: The x component of the translation vector is negated (x -> -x). This moves the object from the right side to the left side, or vice versa.
  2. Rotation: The y and z components of the underlying quaternion are negated. This has the effect of reversing the direction of yaw (rotation around the Y-axis) and roll (rotation around the Z-axis), while leaving pitch (rotation around the X-axis) unchanged.

For example, a pose that places an object 20 dp to the left and yawed 30 degrees to the right will be transformed to place the object 20 dp to the right and yawed 30 degrees to the left.

If the layout direction is LTR, the original pose is used without modification.

This API is not mirroring the internal mesh geometry of 3D models. This function only affects pose of the layout.

Parameters

pose The pose of the layout.