Skip to main content

Adjust position and rotation when spawning

SpawnOffset adds position and rotation offsets to an item when it moves to the player's hand or a Spawn Point. Use it to place items with different sizes, origins, or forward directions naturally at the same destination.

Setup​

  1. Select the root GameObject registered in the Pool of VRCObjectPool
  2. Add the SpawnOffset component
  3. Set Position Offset Y to the vertical distance from the destination
  4. Set Rotation Offset to the X, Y, and Z rotation angles added to the destination
  5. Spawn the item with SpawnObjectExt and check its position and orientation
Component placement

For a normal item, add SpawnOffset to the root GameObject registered in VRCObjectPool. For an item using a helper, the Spawn root and the GameObject assigned to Return Base Go or HG Base are searched. A SpawnOffset on any other child GameObject is not used.

Position offset direction​

Position Offset Y is applied along the destination Transform's local Y axis, not the world Y axis.

For example, when a Spawn Point is tilted, the item moves upward according to that tilt. A positive value moves it along local up, and a negative value moves it along local down.

With Move Item To Hand, the hand position is used as the destination and there is no reference rotation. The position offset is therefore applied along the world Y axis.

Rotation offset​

Rotation Offset is a local rotation specified in X, Y, and Z and added to the destination rotation. It adjusts an item's own forward direction or tilt relative to the Spawn Point orientation.

Conditions for applying offsets​

The offset is applied when the item is moved after Spawn by one of the following settings.

  • Move Item To Hand is enabled
  • A single Spawn Point is assigned
  • A valid destination is selected from multiple Spawn Points

Position and rotation offsets are not applied when no destination is configured and the item appears at the VRCObjectPool position without moving. They are also not applied on Return.

Using a helper component​

Offsets can also be used on an item with HGSpawnHelper or CompSpawnHelper. Add the helper to the root GameObject registered in the Pool. Add SpawnOffset either to that Spawn root or to the GameObject assigned to the helper's HG Base / Return Base Go. The setting on the Spawn root takes priority when both are present.

After the helper's Move Delay, the item moves to the position and rotation including the offset.

Reusing ObonEasy settings​

When ObonEasy v3.0 or later is installed, you can use Position Offset Y and Rotation Offset from TrayItem or TrayItemManual during Spawn without adding SpawnOffset.

Required version

This integration requires ObonEasy v3.0 or later. Older versions of ObonEasy are not supported. In a project without ObonEasy, no TrayItem component is found and Object Spawn Extension continues to work normally.

The search target for a TrayItem component depends on the item structure.

Item structureSearch target
Normal item without a helperSpawn root registered in VRCObjectPool
CompSpawnHelperGameObject assigned to Return Base Go
HGSpawnHelperGameObject assigned to HG Base

The entire child hierarchy and other Pickups are not searched. Add TrayItem or TrayItemManual to the specified GameObject.

For a normal item, only the Spawn root is searched for SpawnOffset. For an item using a helper, both the Spawn root and Return Base Go or HG Base are searched for SpawnOffset.

For an item using a helper, the priority is as follows.

  1. SpawnOffset on the Spawn root
  2. SpawnOffset on Return Base Go or HG Base
  3. TrayItemManual or TrayItem on the same BaseGo

Multiple offsets are not added together.

Test the behavior​

  1. Set a clearly visible positive value in Position Offset Y
  2. Spawn the item and confirm that it moves along the destination's local up direction
  3. Tilt the Spawn Point and confirm that the position offset direction follows the tilt
  4. Set Rotation Offset and confirm that rotation is added relative to the destination orientation
  5. When using ObonEasy integration, remove SpawnOffset and confirm that the offset from the TrayItem component is still applied

See SpawnOffset settings for details about each field.