Class PlayerBodyPartGhostRigidBody
java.lang.Object
net.xmx.velthoric.core.body.VxBody
net.timtaran.interactivemc.body.player.PlayerBodyPartGhostRigidBody
public class PlayerBodyPartGhostRigidBody
extends net.xmx.velthoric.core.body.VxBody
Kinematic ghost rigid body without any physics which will be used to be linked with dynamic rigid body via constraint.
This ghost body tracks the player's VR controller position and orientation, and is connected to the dynamic body through a six-degree-of-freedom constraint.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<PlayerBodyPart> The type of body part (head, hands, etc.).static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<com.github.stephengold.joltjni.Vec3> The half-extents (dimensions) of this ghost body part.static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<UUID> The UUID of the player who owns this ghost body part.Fields inherited from class net.xmx.velthoric.core.body.VxBody
dataStore, physicsId, physicsWorld, synchronizedData, type -
Constructor Summary
ConstructorsConstructorDescriptionPlayerBodyPartGhostRigidBody(net.xmx.velthoric.core.body.VxBodyType type, UUID id) Client-side constructor.PlayerBodyPartGhostRigidBody(net.xmx.velthoric.core.body.VxBodyType type, net.xmx.velthoric.core.physics.world.VxPhysicsWorld world, UUID id) Server-side constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcreateJoltBody(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.core.body.factory.VxRigidBodyFactory factory) Creates the Jolt physics body for this ghost rigid body.protected voiddefineSyncData(net.xmx.velthoric.core.network.synchronization.VxSynchronizedData.Builder builder) voidonBodyAdded(net.minecraft.client.multiplayer.ClientLevel level) Called when the body is added to the client world.voidonBodyRemoved(net.minecraft.client.multiplayer.ClientLevel level) Called when the body is removed from the client world.voidCalled every client tick to ensure the body index is saved.voidonPrePhysicsTick(net.xmx.velthoric.core.physics.world.VxPhysicsWorld world) static voidreadPersistenceData(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.network.VxByteBuf buf) static voidwritePersistenceData(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.network.VxByteBuf buf) Methods inherited from class net.xmx.velthoric.core.body.VxBody
calculateRenderState, get, getBodyId, getCullingAABB, getDataStore, getDataStoreIndex, getNetworkId, getPhysicsId, getPhysicsWorld, getSynchronizedData, getTransform, getTransform, getType, getTypeId, isInitialized, onBodyAdded, onBodyRemoved, onPhysicsTick, onServerTick, onSyncedDataUpdated, onSyncedDataUpdated, setBodyId, setClientData, setDataStoreIndex, setNetworkId, setServerData, writeDirtySyncData, writeInitialSyncData
-
Field Details
-
DATA_HALF_EXTENTS
public static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<com.github.stephengold.joltjni.Vec3> DATA_HALF_EXTENTSThe half-extents (dimensions) of this ghost body part. -
DATA_BODY_PART
public static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<PlayerBodyPart> DATA_BODY_PARTThe type of body part (head, hands, etc.). -
DATA_PLAYER_ID
public static final net.xmx.velthoric.core.network.synchronization.accessor.VxServerAccessor<UUID> DATA_PLAYER_IDThe UUID of the player who owns this ghost body part.
-
-
Constructor Details
-
PlayerBodyPartGhostRigidBody
public PlayerBodyPartGhostRigidBody(net.xmx.velthoric.core.body.VxBodyType type, net.xmx.velthoric.core.physics.world.VxPhysicsWorld world, UUID id) Server-side constructor.- Parameters:
type- the body typeworld- the physics worldid- the unique identifier for this body
-
PlayerBodyPartGhostRigidBody
@Environment(CLIENT) public PlayerBodyPartGhostRigidBody(net.xmx.velthoric.core.body.VxBodyType type, UUID id) Client-side constructor.- Parameters:
type- the body typeid- the unique identifier for this body
-
-
Method Details
-
defineSyncData
protected void defineSyncData(net.xmx.velthoric.core.network.synchronization.VxSynchronizedData.Builder builder) - Overrides:
defineSyncDatain classnet.xmx.velthoric.core.body.VxBody
-
createJoltBody
public static int createJoltBody(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.core.body.factory.VxRigidBodyFactory factory) Creates the Jolt physics body for this ghost rigid body.The body is configured as kinematic (non-physics) and uses a selective collision layer to avoid collisions with other bodies.
- Parameters:
factory- the rigid body factory- Returns:
- the Jolt body ID
-
onPrePhysicsTick
public void onPrePhysicsTick(net.xmx.velthoric.core.physics.world.VxPhysicsWorld world) - Overrides:
onPrePhysicsTickin classnet.xmx.velthoric.core.body.VxBody
-
onBodyAdded
public void onBodyAdded(net.minecraft.client.multiplayer.ClientLevel level) Called when the body is added to the client world.- Overrides:
onBodyAddedin classnet.xmx.velthoric.core.body.VxBody- Parameters:
level- the client level
-
onBodyRemoved
public void onBodyRemoved(net.minecraft.client.multiplayer.ClientLevel level) Called when the body is removed from the client world.- Overrides:
onBodyRemovedin classnet.xmx.velthoric.core.body.VxBody- Parameters:
level- the client level
-
onClientTick
public void onClientTick()Called every client tick to ensure the body index is saved.- Overrides:
onClientTickin classnet.xmx.velthoric.core.body.VxBody
-
writePersistenceData
public static void writePersistenceData(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.network.VxByteBuf buf) -
readPersistenceData
public static void readPersistenceData(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.network.VxByteBuf buf)
-