Package com.github.stephengold.joltjni
Class BodyCreationSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.BodyCreationSettings
- All Implemented Interfaces:
ConstBodyCreationSettings,ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
- Direct Known Subclasses:
Part
Settings used to create a
Body.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate default settings.BodyCreationSettings(ConstShape shape, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape.BodyCreationSettings(ShapeRefC shapeRef, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape reference.BodyCreationSettings(ShapeRef shapeRef, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape reference.BodyCreationSettings(ShapeSettings shapeSettings, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape settings.BodyCreationSettings(ShapeSettingsRef shapeSettingsRef, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape-settings reference. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest whether the created body will be allowed to fall asleep.floatReturn the angular damping constant.Copy the (initial) angular velocity.floatReturn the friction ratio.floatReturn the gravity factor.booleanTest whether the body will be a sensor.floatReturn the linear damping constant.Copy the (initial) linear velocity.Calculate the mass and inertia.Copy the mass-properties override.floatReturn the maximum angular speed.floatReturn the maximum linear speed.Return the motion quality.Return the motion type.intReturn the index of the object layer.Return how the mass-properties override will be used.Return the (initial) location.floatReturn the restitution ratio.Copy the (initial) orientation of the body's axes.getShape()Acquire read-only access to theShape.booleanTest whether the body's mass properties will be calculated.voidsetAllowSleeping(boolean allow) Alter whether the created body will be allowed to fall asleep.voidsetAngularDamping(float damping) Alter the angular damping constant.voidsetAngularVelocity(Vec3Arg omega) Alter the (initial) angular velocity.voidsetFriction(float friction) Alter the friction ratio.voidsetGravityFactor(float factor) Alter the gravity multiplier.voidsetIsSensor(boolean setting) Alter whether the body will be a sensor.voidsetLinearDamping(float damping) Alter the linear damping constant.voidsetLinearVelocity(Vec3Arg velocity) Alter the (initial) linear velocity.voidsetMassPropertiesOverride(MassProperties properties) Alter the mass-properties override.voidsetMaxAngularVelocity(float maxSpeed) Alter the maximum angular speed.voidsetMaxLinearVelocity(float maxSpeed) Alter the maximum linear speed.voidsetMotionQuality(EMotionQuality motionQuality) Alter the motion quality.voidsetMotionType(EMotionType motionType) Alter the motion type.voidsetObjectLayer(int objLayer) Alter the object layer.voidAlter how the mass-properties override will be used.voidsetPosition(RVec3Arg loc) Alter the (initial) location of the body's origin (which might not coincide with its center of mass).voidsetRestitution(float restitution) Alter the restitution ratio.voidsetRotation(QuatArg quat) Alter the (initial) orientation of the body's axes.voidsetShape(ConstShape shape) Replace the shape.voidReplace the shape.voidsetShapeSettings(ShapeSettings shapeSettings) Replace the shape settings.voidsetShapeSettings(ShapeSettingsRef shapeSettingsRef) Replace the shape settings.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, va
-
Constructor Details
-
BodyCreationSettings
public BodyCreationSettings()Instantiate default settings. -
BodyCreationSettings
public BodyCreationSettings(ConstShape shape, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape.- Parameters:
shape- the desired shape (not null)loc- the desired location (not null, unaffected)orient- the desired orientation (not null, unaffected)motionType- the desired motion type (not null)objLayer- the ID of the desired object layer (≥0)
-
BodyCreationSettings
public BodyCreationSettings(ShapeRef shapeRef, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape reference.- Parameters:
shapeRef- a reference to the desired shape (not null)loc- the desired location (not null, unaffected)orient- the desired orientation (not null, unaffected)motionType- the desired motion type (not null)objLayer- the ID of the desired object layer
-
BodyCreationSettings
public BodyCreationSettings(ShapeRefC shapeRef, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape reference.- Parameters:
shapeRef- a reference to the desired shape (not null)loc- the desired location (not null, unaffected)orient- the desired orientation (not null, unaffected)motionType- the desired motion type (not null)objLayer- the ID of the desired object layer
-
BodyCreationSettings
public BodyCreationSettings(ShapeSettings shapeSettings, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape settings.- Parameters:
shapeSettings- the desired shape settings (not null)loc- the desired location (not null, unaffected)orient- the desired orientation (not null, unaffected)motionType- the desired motion type (not null)objLayer- the ID of the desired object layer
-
BodyCreationSettings
public BodyCreationSettings(ShapeSettingsRef shapeSettingsRef, RVec3Arg loc, QuatArg orient, EMotionType motionType, int objLayer) Instantiate settings for the specified shape-settings reference.- Parameters:
shapeSettingsRef- a reference to the desired shape settings (not null)loc- the desired location (not null, unaffected)orient- the desired orientation (not null, unaffected)motionType- the desired motion type (not null)objLayer- the ID of the desired object layer
-
-
Method Details
-
setAllowSleeping
public void setAllowSleeping(boolean allow) Alter whether the created body will be allowed to fall asleep. (native attribute: mAllowSleeping)- Parameters:
allow- true to allow, false to inhibit (default=true)
-
setAngularDamping
public void setAngularDamping(float damping) Alter the angular damping constant. (native attribute: mAngularDamping)- Parameters:
damping- the desired value (in units of 1/second, ≥0, ≤1, default=0.05)
-
setAngularVelocity
Alter the (initial) angular velocity. (native attribute: mAngularVelocity)- Parameters:
omega- the desired angular velocity (radians per second in physics-system coordinates, not null, unaffected, default=(0,0,0))
-
setFriction
public void setFriction(float friction) Alter the friction ratio. (native attribute: mFriction)- Parameters:
friction- the desired ratio (typically ≥0 and ≤1, default=0.2)
-
setGravityFactor
public void setGravityFactor(float factor) Alter the gravity multiplier. (native attribute: mGravityFactor)- Parameters:
factor- the desired multiplier (default=1)
-
setIsSensor
public void setIsSensor(boolean setting) Alter whether the body will be a sensor. (native attribute: mIsSensor)- Parameters:
setting- true for a sensor, otherwise false (default=false)
-
setLinearDamping
public void setLinearDamping(float damping) Alter the linear damping constant. (native attribute: mLinearDamping)- Parameters:
damping- the desired value (in units of 1/second, ≥0, ≤1, default=0.05)
-
setLinearVelocity
Alter the (initial) linear velocity. (native attribute: mLinearVelocity)- Parameters:
velocity- the desired velocity (in physics-system coordinates, not null, unaffected, default=(0,0,0))
-
setMassPropertiesOverride
Alter the mass-properties override. (native attribute: mMassPropertiesOverride)- Parameters:
properties- the desired properties (not null, unaffected)
-
setMaxAngularVelocity
public void setMaxAngularVelocity(float maxSpeed) Alter the maximum angular speed. (native attribute: mMaxAngularVelocity)- Parameters:
maxSpeed- the desired maximum speed (in radians/second, ≥0, default=15*pi)
-
setMaxLinearVelocity
public void setMaxLinearVelocity(float maxSpeed) Alter the maximum linear speed. (native attribute: mMaxLinearVelocity)- Parameters:
maxSpeed- the desired maximum speed (in meters/second, ≥0, default=500)
-
setMotionQuality
Alter the motion quality. (native attribute: mMotionQuality)- Parameters:
motionQuality- the desired quality (not null, default=Discrete)
-
setMotionType
Alter the motion type. (native attribute: mMotionType)- Parameters:
motionType- the desired type (not null, default=Dynamic)
-
setObjectLayer
public void setObjectLayer(int objLayer) Alter the object layer. (native attribute: mObjectLayer)- Parameters:
objLayer- the ID of the desired object layer (≥0, <numObjectLayers, default=0)
-
setOverrideMassProperties
Alter how the mass-properties override will be used. (native attribute: mOverrideMassProperties)- Parameters:
setting- an enum value (not null, default=CalculateMassAndInertia)
-
setPosition
Alter the (initial) location of the body's origin (which might not coincide with its center of mass). (native attribute: mPosition)- Parameters:
loc- the desired location (in physics-system coordinates, not null, unaffected, default=(0,0,0))
-
setRestitution
public void setRestitution(float restitution) Alter the restitution ratio. (native attribute: mRestitution)- Parameters:
restitution- the desired ratio (typically ≥0 and ≤1, default=0)
-
setRotation
Alter the (initial) orientation of the body's axes. (native attribute: mRotation)- Parameters:
quat- the desired rotation (relative to the physics-system axes, not null, unaffected, default=(0,0,0,1))
-
setShape
Replace the shape.- Parameters:
shape- the desired shape (not null, unaffected)
-
setShape
Replace the shape.- Parameters:
shapeRef- a reference to the desired shape (not null)
-
setShapeSettings
Replace the shape settings.- Parameters:
shapeSettings- the desired shape settings (not null)
-
setShapeSettings
Replace the shape settings.- Parameters:
shapeSettingsRef- a reference to the desired shape settings (not null)
-
getAllowSleeping
public boolean getAllowSleeping()Test whether the created body will be allowed to fall asleep. The settings are unaffected. (native attribute: mAllowSleeping)- Specified by:
getAllowSleepingin interfaceConstBodyCreationSettings- Returns:
- true if allowed, otherwise false
-
getAngularDamping
public float getAngularDamping()Return the angular damping constant. The settings are unaffected. (native attribute: mAngularDamping)- Specified by:
getAngularDampingin interfaceConstBodyCreationSettings- Returns:
- the constant (in units of 1/second, ≥0, ≤1)
-
getAngularVelocity
Copy the (initial) angular velocity. The settings are unaffected. (native attribute: mAngularVelocity)- Specified by:
getAngularVelocityin interfaceConstBodyCreationSettings- Returns:
- a new velocity vector (radians per second in physics-system coordinates)
-
getFriction
public float getFriction()Return the friction ratio. The settings are unaffected. (native attribute: mFriction)- Specified by:
getFrictionin interfaceConstBodyCreationSettings- Returns:
- the ratio (typically ≥0 and ≤1)
-
getGravityFactor
public float getGravityFactor()Return the gravity factor. The settings are unaffected. (native attribute: mGravityFactor)- Specified by:
getGravityFactorin interfaceConstBodyCreationSettings- Returns:
- the factor
-
getIsSensor
public boolean getIsSensor()Test whether the body will be a sensor. The settings are unaffected. (native attribute: mIsSensor)- Specified by:
getIsSensorin interfaceConstBodyCreationSettings- Returns:
- true for a sensor, otherwise false
-
getLinearDamping
public float getLinearDamping()Return the linear damping constant. The settings are unaffected. (native attribute: mLinearDamping)- Specified by:
getLinearDampingin interfaceConstBodyCreationSettings- Returns:
- the constant (in units of 1/second, ≥0, ≤1)
-
getLinearVelocity
Copy the (initial) linear velocity. The settings are unaffected. (native attribute: mLinearVelocity)- Specified by:
getLinearVelocityin interfaceConstBodyCreationSettings- Returns:
- a new velocity vector (meters per second in physics-system coordinates)
-
getMassProperties
Calculate the mass and inertia. The settings are unaffected.- Specified by:
getMassPropertiesin interfaceConstBodyCreationSettings- Returns:
- a new JVM object with a new native object assigned
-
getMassPropertiesOverride
Copy the mass-properties override. The settings are unaffected. (native attribute: mMassPropertiesOverride)- Specified by:
getMassPropertiesOverridein interfaceConstBodyCreationSettings- Returns:
- a new JVM object with a new native object assigned
-
getMaxAngularVelocity
public float getMaxAngularVelocity()Return the maximum angular speed. The settings are unaffected. (native attribute: mMaxAngularVelocity)- Specified by:
getMaxAngularVelocityin interfaceConstBodyCreationSettings- Returns:
- the maximum speed (in radians/second)
-
getMaxLinearVelocity
public float getMaxLinearVelocity()Return the maximum linear speed. The settings are unaffected. (native attribute: mMaxLinearVelocity)- Specified by:
getMaxLinearVelocityin interfaceConstBodyCreationSettings- Returns:
- the maximum speed (in meters/second)
-
getMotionQuality
Return the motion quality. The settings are unaffected. (native attribute: mMotionQuality)- Specified by:
getMotionQualityin interfaceConstBodyCreationSettings- Returns:
- an enum value (not null)
-
getMotionType
Return the motion type. The settings are unaffected. (native attribute: mMotionType)- Specified by:
getMotionTypein interfaceConstBodyCreationSettings- Returns:
- an enum value (not null)
-
getObjectLayer
public int getObjectLayer()Return the index of the object layer. The settings are unaffected. (native attribute: mObjectLayer)- Specified by:
getObjectLayerin interfaceConstBodyCreationSettings- Returns:
- the layer index (≥0, <numObjectLayers)
-
getOverrideMassProperties
Return how the mass-properties override will be used. The settings are unaffected. (native attribute: mOverrideMassProperties)- Specified by:
getOverrideMassPropertiesin interfaceConstBodyCreationSettings- Returns:
- an enum value (not null)
-
getPosition
Return the (initial) location. The settings are unaffected. (native attribute: mPosition)- Specified by:
getPositionin interfaceConstBodyCreationSettings- Returns:
- a new location vector (in physics-system coordinates, all components finite)
-
getRestitution
public float getRestitution()Return the restitution ratio. The settings are unaffected. (native attribute: mRestitution)- Specified by:
getRestitutionin interfaceConstBodyCreationSettings- Returns:
- the ratio (typically ≥0 and ≤1)
-
getRotation
Copy the (initial) orientation of the body's axes. The settings are unaffected. (native attribute: mRotation)- Specified by:
getRotationin interfaceConstBodyCreationSettings- Returns:
- a new rotation quaternion (relative to the physics-system axes)
-
getShape
Acquire read-only access to theShape. The settings are unaffected.- Specified by:
getShapein interfaceConstBodyCreationSettings- Returns:
- a new JVM object with the pre-existing native object assigned, or
null
-
hasMassProperties
public boolean hasMassProperties()Test whether the body's mass properties will be calculated. The settings are unaffected.- Specified by:
hasMassPropertiesin interfaceConstBodyCreationSettings- Returns:
- true if calculated, otherwise false
-