Skip to content

Prototype: Physics

A simple Physics library adding player Ragdolls.

8k downloads Updated

No ratings yet

Be the first to rate it.

Rate it

Community listing page

Community listing page, reviews may not be monitored by the author.

About

Description

A simple Experimental Ragdoll library for Minecraft Player.
Uses Jbullet Physics engine.

Mod Adds following events for interacting with the Physics.
- 

PlayerPartHitEvent
RagdollModeChangeEvent
RagdollClickEvent


Example Usage:

@SubscribeEvent
public static void onPPI(RagdollClickEvent event){
var player = event.getSource();
var part = event.getTarget();
System.out.printf("%s| %s| %s| %s",
player.getName().getString(),
part.getName().getString(),
event.getPartName(),
event.getContactPoint()
);
// e.g., apply damage, play sound, spawn particles, etc.
}



example for Applying velocities and Rotations:

@SubscribeEvent
public static void onRagdolClick(RagdollClickEvent event){
JbulletWorld jworld = JbulletWorld.get((ServerLevel)event.getSource().level());
PlayerPhysics playerPhysics = jworld.getPlayerPhys(event.getTarget());
playerPhysics.applyVel(RagdollPart.TORSO,new Vec3(0,4f,0));
}
@SubscribeEvent
public static void onRagdolClick(RagdollClickEvent event){
JbulletWorld jworld = JbulletWorld.get((ServerLevel)event.getSource().level());
PlayerPhysics playerPhysics = jworld.getPlayerPhys(event.getTarget());
playerPhysics.applyTorque(RagdollPart.TORSO,new Vec3(0,4f,0));
}