JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
jsim.jni.JSimJNI Class Reference

Classes

class  Helper

Static Public Member Functions

static synchronized void forceLoad ()
static native int initialize ()
static native long createWorld (double fixedDtSeconds, boolean enableGravity)
static native void destroyWorld (long worldHandle)
static native int createBody (long worldHandle, double massKg)
static native int createGamepiece (long worldHandle)
static native int createGamepiece (long worldHandle, double radiusMeters, double massKg, double restitution)
static native int createGamepieceWithType (long worldHandle, int type, double radiusMeters, double massKg, double restitution)
static native int createGamepieceWithTypeName (long worldHandle, String typeName, double radiusMeters, double massKg, double restitution)
static native String getGamepieceTypeName (long worldHandle, int gamepieceIndex)
static native int setBodyPosition (long worldHandle, int bodyIndex, double xMeters, double yMeters, double zMeters)
static native int setBodyLinearVelocity (long worldHandle, int bodyIndex, double vxMps, double vyMps, double vzMps)
static native int setBodyOrientation (long worldHandle, int bodyIndex, double qw, double qx, double qy, double qz)
static native int setBodyGravityEnabled (long worldHandle, int bodyIndex, boolean enabled)
static native int setBodyMaterial (long worldHandle, int bodyIndex, double restitution, double frictionKinetic, double frictionStatic, double collisionDamping)
static native int setBodyMaterialId (long worldHandle, int bodyIndex, int materialId)
static native int setBodyCollisionFilter (long worldHandle, int bodyIndex, int collisionLayerBits, int collisionMaskBits)
static native int setBodyAerodynamicSphere (long worldHandle, int bodyIndex, double radiusMeters, double dragCoefficient)
static native int setBodyAerodynamicBox (long worldHandle, int bodyIndex, double xMeters, double yMeters, double zMeters, double dragCoefficient)
static native int pickGamepiece (long worldHandle, int gamepieceIndex, double intakeX, double intakeY, double intakeZ, double captureRadius, double carryOffsetX, double carryOffsetY, double carryOffsetZ)
static native int placeGamepiece (long worldHandle, int gamepieceIndex, double xMeters, double yMeters, double zMeters)
static native int outtakeGamepiece (long worldHandle, int gamepieceIndex, double px, double py, double pz, double vx, double vy, double vz)
static native int setGamepiecePosition (long worldHandle, int gamepieceIndex, double xMeters, double yMeters, double zMeters)
static native int setGamepieceLinearVelocity (long worldHandle, int gamepieceIndex, double vxMps, double vyMps, double vzMps)
static native int getGamepiecePosition (long worldHandle, int gamepieceIndex, double[] outXyzMeters)
static native int getGamepieceLinearVelocity (long worldHandle, int gamepieceIndex, double[] outVxyzMps)
static native int setWorldGravity (long worldHandle, double gxMps2, double gyMps2, double gzMps2)
static native int setWorldAerodynamics (long worldHandle, boolean enabled, double airDensityKgPm3, double linearDragNPerMps, double magnusCoefficient, double defaultDragCoefficient, double defaultReferenceAreaM2)
static native int setMaterialInteraction (long worldHandle, int materialAId, int materialBId, double restitution, double friction, boolean enabled)
static native int stepWorld (long worldHandle, int steps)
static native int getBodyPosition (long worldHandle, int bodyIndex, double[] outXyzMeters)
static native int getBodyLinearVelocity (long worldHandle, int bodyIndex, double[] outVxyzMps)
static native int getBodyOrientation (long worldHandle, int bodyIndex, double[] outWxyz)
static native int getBodyPose7Array (long worldHandle, double[] outPose7)
static native int getBodyVelocity6Array (long worldHandle, double[] outVelocity6)
static native int getBodyState13Array (long worldHandle, double[] outState13)

Detailed Description

JNI entry points for the vendor physics driver.

Member Function Documentation

◆ createBody()

native int jsim.jni.JSimJNI.createBody ( long worldHandle,
double massKg )
static

Creates a body in the given world and returns its native index.

Parameters
worldHandlethe native world handle
massKgthe body mass in kilograms
Returns
the native body index

◆ createGamepiece() [1/2]

native int jsim.jni.JSimJNI.createGamepiece ( long worldHandle)
static

Creates a generic gamepiece using the legacy ball-compatible defaults.

Parameters
worldHandlethe native world handle
Returns
the native gamepiece index

◆ createGamepiece() [2/2]

native int jsim.jni.JSimJNI.createGamepiece ( long worldHandle,
double radiusMeters,
double massKg,
double restitution )
static

Creates a generic gamepiece with a spherical hitbox in the world.

Parameters
worldHandlethe native world handle
radiusMeterssphere hitbox radius in meters
massKggamepiece mass in kilograms
restitutioncoefficient of restitution in [0, 1]
Returns
the native gamepiece index

◆ createGamepieceWithType()

native int jsim.jni.JSimJNI.createGamepieceWithType ( long worldHandle,
int type,
double radiusMeters,
double massKg,
double restitution )
static

Creates a generic gamepiece with explicit type tag.

Parameters
worldHandlenative world handle
typeordinal value from GamePieceType
radiusMeterssphere radius in meters
massKgmass in kilograms
restitutioncoefficient of restitution
Returns
native gamepiece index

◆ createGamepieceWithTypeName()

native int jsim.jni.JSimJNI.createGamepieceWithTypeName ( long worldHandle,
String typeName,
double radiusMeters,
double massKg,
double restitution )
static

Creates a generic gamepiece with a string type name.

Parameters
worldHandlenative world handle
typeNamehuman readable type name (e.g. "generic_sphere")
radiusMeterssphere radius in meters
massKgmass in kilograms
restitutioncoefficient of restitution
Returns
native gamepiece index

◆ createWorld()

native long jsim.jni.JSimJNI.createWorld ( double fixedDtSeconds,
boolean enableGravity )
static

Creates a native world handle.

Parameters
fixedDtSecondsthe fixed simulation timestep in seconds
enableGravitytrue to enable gravity for the world
Returns
the native world handle

◆ destroyWorld()

native void jsim.jni.JSimJNI.destroyWorld ( long worldHandle)
static

Destroys a native world handle.

Parameters
worldHandlethe native world handle to destroy

◆ forceLoad()

synchronized void jsim.jni.JSimJNI.forceLoad ( )
inlinestatic

Forces the native library to load.

◆ getBodyLinearVelocity()

native int jsim.jni.JSimJNI.getBodyLinearVelocity ( long worldHandle,
int bodyIndex,
double[] outVxyzMps )
static

Reads a body's linear velocity into outVxyzMps.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
outVxyzMpsthe output array that receives the linear velocity
Returns
zero on success

◆ getBodyOrientation()

native int jsim.jni.JSimJNI.getBodyOrientation ( long worldHandle,
int bodyIndex,
double[] outWxyz )
static

Reads a body's orientation as a quaternion into outWxyz.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
outWxyzthe output array that receives qw,qx,qy,qz
Returns
zero on success

◆ getBodyPose7Array()

native int jsim.jni.JSimJNI.getBodyPose7Array ( long worldHandle,
double[] outPose7 )
static

Exports flattened body poses as [x, y, z, qw, qx, qy, qz] blocks.

Parameters
worldHandlethe native world handle
outPose7the destination array sized for N*7 entries
Returns
the number of body blocks written, or negative on error

◆ getBodyPosition()

native int jsim.jni.JSimJNI.getBodyPosition ( long worldHandle,
int bodyIndex,
double[] outXyzMeters )
static

Reads a body's position into outXyzMeters.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
outXyzMetersthe output array that receives the position
Returns
zero on success

◆ getBodyState13Array()

native int jsim.jni.JSimJNI.getBodyState13Array ( long worldHandle,
double[] outState13 )
static

Exports flattened full body state as [x, y, z, qw, qx, qy, qz, vx, vy, vz, wx, wy, wz] blocks.

Parameters
worldHandlethe native world handle
outState13the destination array sized for N*13 entries
Returns
the number of body blocks written, or negative on error

◆ getBodyVelocity6Array()

native int jsim.jni.JSimJNI.getBodyVelocity6Array ( long worldHandle,
double[] outVelocity6 )
static

Exports flattened body velocities as [vx, vy, vz, wx, wy, wz] blocks.

Parameters
worldHandlethe native world handle
outVelocity6the destination array sized for N*6 entries
Returns
the number of body blocks written, or negative on error

◆ getGamepieceLinearVelocity()

native int jsim.jni.JSimJNI.getGamepieceLinearVelocity ( long worldHandle,
int gamepieceIndex,
double[] outVxyzMps )
static

Native: get gamepiece linear velocity.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
outVxyzMpsoutput array of length 3 receiving vx,vy,vz in m/s
Returns
zero on success, non-zero on failure

◆ getGamepiecePosition()

native int jsim.jni.JSimJNI.getGamepiecePosition ( long worldHandle,
int gamepieceIndex,
double[] outXyzMeters )
static

Native: get gamepiece position.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
outXyzMetersoutput array of length 3 receiving x,y,z in meters
Returns
zero on success, non-zero on failure

◆ getGamepieceTypeName()

native String jsim.jni.JSimJNI.getGamepieceTypeName ( long worldHandle,
int gamepieceIndex )
static

Reads the registered type name for a gamepiece.

Parameters
worldHandlenative world handle
gamepieceIndexnative gamepiece index
Returns
UTF-8 type name or null when unknown

◆ initialize()

native int jsim.jni.JSimJNI.initialize ( )
static

Initializes the native driver.

Returns
the value returned by the driver

◆ outtakeGamepiece()

native int jsim.jni.JSimJNI.outtakeGamepiece ( long worldHandle,
int gamepieceIndex,
double px,
double py,
double pz,
double vx,
double vy,
double vz )
static

Launches (outtakes) a gamepiece with the specified position and velocity.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
pxlaunch position x in meters
pylaunch position y in meters
pzlaunch position z in meters
vxlaunch velocity x in m/s
vylaunch velocity y in m/s
vzlaunch velocity z in m/s
Returns
zero on success, non-zero on failure

◆ pickGamepiece()

native int jsim.jni.JSimJNI.pickGamepiece ( long worldHandle,
int gamepieceIndex,
double intakeX,
double intakeY,
double intakeZ,
double captureRadius,
double carryOffsetX,
double carryOffsetY,
double carryOffsetZ )
static

Attempts to pick up a gamepiece into a carrier location.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
intakeXworld-space intake x coordinate
intakeYworld-space intake y coordinate
intakeZworld-space intake z coordinate
captureRadiuscapture radius in meters
carryOffsetXcarry offset x in meters
carryOffsetYcarry offset y in meters
carryOffsetZcarry offset z in meters
Returns
zero on success, non-zero on failure

◆ placeGamepiece()

native int jsim.jni.JSimJNI.placeGamepiece ( long worldHandle,
int gamepieceIndex,
double xMeters,
double yMeters,
double zMeters )
static

Places a gamepiece at the given world position and marks it grounded.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
xMetersx position in meters
yMetersy position in meters
zMetersz position in meters
Returns
zero on success, non-zero on failure

◆ setBodyAerodynamicBox()

native int jsim.jni.JSimJNI.setBodyAerodynamicBox ( long worldHandle,
int bodyIndex,
double xMeters,
double yMeters,
double zMeters,
double dragCoefficient )
static

Assigns box aerodynamic geometry to a body (useful for robot CAD components).

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
xMetersbox x dimension in meters
yMetersbox y dimension in meters
zMetersbox z dimension in meters
dragCoefficientdrag coefficient (dimensionless)
Returns
zero on success

◆ setBodyAerodynamicSphere()

native int jsim.jni.JSimJNI.setBodyAerodynamicSphere ( long worldHandle,
int bodyIndex,
double radiusMeters,
double dragCoefficient )
static

Assigns sphere aerodynamic geometry to a body (useful for game pieces from CAD).

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
radiusMeterssphere radius in meters
dragCoefficientdrag coefficient (dimensionless)
Returns
zero on success

◆ setBodyCollisionFilter()

native int jsim.jni.JSimJNI.setBodyCollisionFilter ( long worldHandle,
int bodyIndex,
int collisionLayerBits,
int collisionMaskBits )
static

Sets collision layer and mask filters for this body.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
collisionLayerBitsbody layer bitmask
collisionMaskBitsbody mask bitmask
Returns
zero on success

◆ setBodyGravityEnabled()

native int jsim.jni.JSimJNI.setBodyGravityEnabled ( long worldHandle,
int bodyIndex,
boolean enabled )
static

Enables or disables gravity for a body.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
enabledtrue to enable gravity, false to disable it
Returns
zero on success

◆ setBodyLinearVelocity()

native int jsim.jni.JSimJNI.setBodyLinearVelocity ( long worldHandle,
int bodyIndex,
double vxMps,
double vyMps,
double vzMps )
static

Sets a body's linear velocity in meters per second.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
vxMpsthe x velocity in meters per second
vyMpsthe y velocity in meters per second
vzMpsthe z velocity in meters per second
Returns
zero on success

◆ setBodyMaterial()

native int jsim.jni.JSimJNI.setBodyMaterial ( long worldHandle,
int bodyIndex,
double restitution,
double frictionKinetic,
double frictionStatic,
double collisionDamping )
static

Sets per-body material contact properties.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
restitutioncoefficient of restitution [0, 1]
frictionKinetickinetic friction coefficient
frictionStaticstatic friction coefficient
collisionDampingdamping coefficient [0, 1]
Returns
zero on success

◆ setBodyMaterialId()

native int jsim.jni.JSimJNI.setBodyMaterialId ( long worldHandle,
int bodyIndex,
int materialId )
static

Sets numeric material identifier used by world material-interaction tables.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
materialIdnumeric material id
Returns
zero on success

◆ setBodyOrientation()

native int jsim.jni.JSimJNI.setBodyOrientation ( long worldHandle,
int bodyIndex,
double qw,
double qx,
double qy,
double qz )
static

Sets a body's world-space orientation as a quaternion.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
qwquaternion w component
qxquaternion x component
qyquaternion y component
qzquaternion z component
Returns
zero on success

◆ setBodyPosition()

native int jsim.jni.JSimJNI.setBodyPosition ( long worldHandle,
int bodyIndex,
double xMeters,
double yMeters,
double zMeters )
static

Sets a body's position in meters.

Parameters
worldHandlethe native world handle
bodyIndexthe native body index
xMetersthe x position in meters
yMetersthe y position in meters
zMetersthe z position in meters
Returns
zero on success

◆ setGamepieceLinearVelocity()

native int jsim.jni.JSimJNI.setGamepieceLinearVelocity ( long worldHandle,
int gamepieceIndex,
double vxMps,
double vyMps,
double vzMps )
static

Native: set gamepiece linear velocity.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
vxMpsx velocity in meters per second
vyMpsy velocity in meters per second
vzMpsz velocity in meters per second
Returns
zero on success, non-zero on failure

◆ setGamepiecePosition()

native int jsim.jni.JSimJNI.setGamepiecePosition ( long worldHandle,
int gamepieceIndex,
double xMeters,
double yMeters,
double zMeters )
static

Native: set gamepiece position.

Parameters
worldHandlethe native world handle
gamepieceIndexthe native gamepiece index
xMetersx position in meters
yMetersy position in meters
zMetersz position in meters
Returns
zero on success, non-zero on failure

◆ setMaterialInteraction()

native int jsim.jni.JSimJNI.setMaterialInteraction ( long worldHandle,
int materialAId,
int materialBId,
double restitution,
double friction,
boolean enabled )
static

Sets per-material-pair contact interaction overrides.

Parameters
worldHandlethe native world handle
materialAIdfirst material id
materialBIdsecond material id
restitutionoverride restitution [0, 1]
frictionoverride kinetic friction coefficient
enabledtrue to enable this pair override
Returns
zero on success

◆ setWorldAerodynamics()

native int jsim.jni.JSimJNI.setWorldAerodynamics ( long worldHandle,
boolean enabled,
double airDensityKgPm3,
double linearDragNPerMps,
double magnusCoefficient,
double defaultDragCoefficient,
double defaultReferenceAreaM2 )
static

Configures world-level aerodynamics parameters.

Parameters
worldHandlethe native world handle
enabledtrue to enable aerodynamics
airDensityKgPm3air density in kg/m^3
linearDragNPerMpslinear drag coefficient in N/(m/s)
magnusCoefficientMagnus coefficient
defaultDragCoefficientdefault drag coefficient
defaultReferenceAreaM2default drag reference area in m^2
Returns
zero on success

◆ setWorldGravity()

native int jsim.jni.JSimJNI.setWorldGravity ( long worldHandle,
double gxMps2,
double gyMps2,
double gzMps2 )
static

Sets the world's gravity vector in meters per second squared.

Parameters
worldHandlethe native world handle
gxMps2the x gravity component in meters per second squared
gyMps2the y gravity component in meters per second squared
gzMps2the z gravity component in meters per second squared
Returns
zero on success

◆ stepWorld()

native int jsim.jni.JSimJNI.stepWorld ( long worldHandle,
int steps )
static

Advances the world by the given number of steps.

Parameters
worldHandlethe native world handle
stepsthe number of steps to advance
Returns
zero on success

The documentation for this class was generated from the following file: