Class GrabbableBody

java.lang.Object
net.xmx.velthoric.core.body.VxBody
net.timtaran.interactivemc.body.type.GrabbableBody

public abstract class GrabbableBody extends net.xmx.velthoric.core.body.VxBody
An abstract base class for bodies that can be grabbed by other bodies.

Unlike a regular rigid body, this body allows you to specify a custom grab point and grab rotation point, determining exactly where and how the body will be grabbed when another entity interacts with it.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<com.github.stephengold.joltjni.Vec3>
    Server-side accessor for the main grab point position in local space.
    static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<com.github.stephengold.joltjni.Vec3>
    Server-side accessor for the grab point rotation reference in local space.

    Fields inherited from class net.xmx.velthoric.core.body.VxBody

    dataStore, physicsId, physicsWorld, synchronizedData, type
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    GrabbableBody(net.xmx.velthoric.core.body.VxBodyType type, UUID id)
    Client-side constructor for a grabbable rigid body.
    protected
    GrabbableBody(net.xmx.velthoric.core.body.VxBodyType type, net.xmx.velthoric.core.physics.world.VxPhysicsWorld world, UUID id)
    Server-side constructor for a grabbable rigid body.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    readPersistenceData(net.xmx.velthoric.network.VxByteBuf buf)
    Reads the grab point data from the persistence buffer.
    void
    writePersistenceData(net.xmx.velthoric.network.VxByteBuf buf)
    Writes the grab point data to the persistence buffer.

    Methods inherited from class net.xmx.velthoric.core.body.VxBody

    calculateRenderState, defineSyncData, get, getBodyId, getCullingAABB, getDataStore, getDataStoreIndex, getNetworkId, getPhysicsId, getPhysicsWorld, getSynchronizedData, getTransform, getTransform, getType, getTypeId, isInitialized, onBodyAdded, onBodyAdded, onBodyRemoved, onBodyRemoved, onClientTick, onPhysicsTick, onPrePhysicsTick, onServerTick, onSyncedDataUpdated, onSyncedDataUpdated, setBodyId, setClientData, setDataStoreIndex, setNetworkId, setServerData, writeDirtySyncData, writeInitialSyncData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DATA_MAIN_GRAB_POINT_POSITION

      public static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<com.github.stephengold.joltjni.Vec3> DATA_MAIN_GRAB_POINT_POSITION
      Server-side accessor for the main grab point position in local space.

      This defines where on the body a grabber will grab it. When pulled, the grabber's hand will align with this point.

    • DATA_MAIN_GRAB_POINT_ROTATION

      public static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<com.github.stephengold.joltjni.Vec3> DATA_MAIN_GRAB_POINT_ROTATION
      Server-side accessor for the grab point rotation reference in local space.

      This defines how the body will be rotated relative to the grabber's hand. It provides the rotation axis/reference for the grabbed body.

  • Constructor Details

    • GrabbableBody

      protected GrabbableBody(net.xmx.velthoric.core.body.VxBodyType type, net.xmx.velthoric.core.physics.world.VxPhysicsWorld world, UUID id)
      Server-side constructor for a grabbable rigid body.
      Parameters:
      type - the body type definition
      world - the physics world this body belongs to
      id - the unique UUID for this body
    • GrabbableBody

      @Environment(CLIENT) protected GrabbableBody(net.xmx.velthoric.core.body.VxBodyType type, UUID id)
      Client-side constructor for a grabbable rigid body.
      Parameters:
      type - the body type definition
      id - the unique UUID for this body
  • Method Details

    • writePersistenceData

      public void writePersistenceData(net.xmx.velthoric.network.VxByteBuf buf)
      Writes the grab point data to the persistence buffer.
      Parameters:
      buf - the buffer to write to
    • readPersistenceData

      public void readPersistenceData(net.xmx.velthoric.network.VxByteBuf buf)
      Reads the grab point data from the persistence buffer.
      Parameters:
      buf - the buffer to read from