java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.ContactSettings
- All Implemented Interfaces:
ConstContactSettings
,ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Properties of a contact constraint that can be overridden during certain
ContactListener
callbacks.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate the default settings for testing.ContactSettings
(long settingsVa) Instantiate settings with the specified native object assigned but not owned. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the combined friction for the body pair.float
Return the combined restitution for the body pair.float
Return the scale factor for the inverse inertia of body 1.float
Return the scale factor for the inverse inertia of body 2.float
Return the scale factor for the inverse mass of body 1.float
Return the scale factor for the inverse mass of body 2.boolean
Test whether the contact should be treated as a sensor (no collision response).Copy the relative angular velocity (body 2 minus body 1).Copy the relative linear velocity (body 2 minus body 1).void
setCombinedFriction
(float friction) Alter the combined friction for the body pair.void
setCombinedRestitution
(float restitution) Alter the combined restitution for the body pair.void
setInvInertiaScale1
(float factor) Alter the scale factor for the inverse inertia of body 1.void
setInvInertiaScale2
(float factor) Alter the scale factor for the inverse inertia of body 2.void
setInvMassScale1
(float factor) Alter the scale factor for the inverse mass of body 1.void
setInvMassScale2
(float factor) Alter the scale factor for the inverse mass of body 2.void
setIsSensor
(boolean setting) Alter whether the contact should be treated as a sensor (no collision response).void
Alter the relative angular velocity (body 2 minus body 1).void
setRelativeLinearSurfaceVelocity
(Vec3Arg velocity) Alter the relative linear velocity (body 2 minus body 1).Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
ContactSettings
public ContactSettings()Instantiate the default settings for testing. -
ContactSettings
public ContactSettings(long settingsVa) Instantiate settings with the specified native object assigned but not owned.- Parameters:
settingsVa
- the virtual address of the native object to assign (not zero)
-
-
Method Details
-
setCombinedFriction
public void setCombinedFriction(float friction) Alter the combined friction for the body pair. (native attribute: mCombinedFriction)- Parameters:
friction
- the desired combined friction (default=0)
-
setCombinedRestitution
public void setCombinedRestitution(float restitution) Alter the combined restitution for the body pair. (native attribute: mCombinedRestitution)- Parameters:
restitution
- the desired combined restitution (default=0)
-
setInvInertiaScale1
public void setInvInertiaScale1(float factor) Alter the scale factor for the inverse inertia of body 1. (native attribute: mInvInertiaScale1)- Parameters:
factor
- the factor (0 = infinite inertia, 1 = use original inertia, default=1)
-
setInvInertiaScale2
public void setInvInertiaScale2(float factor) Alter the scale factor for the inverse inertia of body 2. (native attribute: mInvInertiaScale2)- Parameters:
factor
- the factor (0 = infinite inertia, 1 = use original inertia, default=1)
-
setInvMassScale1
public void setInvMassScale1(float factor) Alter the scale factor for the inverse mass of body 1. (native attribute: mInvMassScale1)- Parameters:
factor
- the factor (0 = infinite mass, 1 = use original mass, default=1)
-
setInvMassScale2
public void setInvMassScale2(float factor) Alter the scale factor for the inverse mass of body 2. (native attribute: mInvMassScale2)- Parameters:
factor
- the factor (0 = infinite mass, 1 = use original mass, default=1)
-
setIsSensor
public void setIsSensor(boolean setting) Alter whether the contact should be treated as a sensor (no collision response). (native attribute: mIsSensor)- Parameters:
setting
-true
to treat as a sensor, otherwisefalse
(default=false)
-
setRelativeAngularSurfaceVelocity
Alter the relative angular velocity (body 2 minus body 1). (native attribute: mRelativeAngularSurfaceVelocity)- Parameters:
omega
- the desired angular velocity (radians per second in system coordinates, default=(0,0,0))
-
setRelativeLinearSurfaceVelocity
Alter the relative linear velocity (body 2 minus body 1). (native attribute: mRelativeLinearSurfaceVelocity)- Parameters:
velocity
- the desired velocity (meters per second in system coordinates, default=(0,0,0))
-
getCombinedFriction
public float getCombinedFriction()Return the combined friction for the body pair. The settings are unaffected. (native attribute: mCombinedFriction)- Specified by:
getCombinedFriction
in interfaceConstContactSettings
- Returns:
- the combined friction
-
getCombinedRestitution
public float getCombinedRestitution()Return the combined restitution for the body pair. The settings are unaffected. (native attribute: mCombinedRestitution)- Specified by:
getCombinedRestitution
in interfaceConstContactSettings
- Returns:
- the combined restitution
-
getInvInertiaScale1
public float getInvInertiaScale1()Return the scale factor for the inverse inertia of body 1. The settings are unaffected. (native attribute: mInvInertiaScale1)- Specified by:
getInvInertiaScale1
in interfaceConstContactSettings
- Returns:
- the factor (0 = infinite inertia, 1 = use original inertia)
-
getInvInertiaScale2
public float getInvInertiaScale2()Return the scale factor for the inverse inertia of body 2. The settings are unaffected. (native attribute: mInvInertiaScale2)- Specified by:
getInvInertiaScale2
in interfaceConstContactSettings
- Returns:
- the factor (0 = infinite inertia, 1 = use original inertia)
-
getInvMassScale1
public float getInvMassScale1()Return the scale factor for the inverse mass of body 1. The settings are unaffected. (native attribute: mInvMassScale1)- Specified by:
getInvMassScale1
in interfaceConstContactSettings
- Returns:
- the factor (0 = infinite mass, 1 = use original mass)
-
getInvMassScale2
public float getInvMassScale2()Return the scale factor for the inverse mass of body 2. The settings are unaffected. (native attribute: mInvMassScale2)- Specified by:
getInvMassScale2
in interfaceConstContactSettings
- Returns:
- the factor (0 = infinite mass, 1 = use original mass)
-
getIsSensor
public boolean getIsSensor()Test whether the contact should be treated as a sensor (no collision response). The settings are unaffected. (native attribute: mIsSensor)- Specified by:
getIsSensor
in interfaceConstContactSettings
- Returns:
true
if treated as a sensor, otherwisefalse
-
getRelativeAngularSurfaceVelocity
Copy the relative angular velocity (body 2 minus body 1). The settings are unaffected. (native attribute: mRelativeAngularSurfaceVelocity)- Specified by:
getRelativeAngularSurfaceVelocity
in interfaceConstContactSettings
- Returns:
- a new velocity vector (radians per second in system coordinates)
-
getRelativeLinearSurfaceVelocity
Copy the relative linear velocity (body 2 minus body 1). The settings are unaffected. (native attribute: mRelativeLinearSurfaceVelocity)- Specified by:
getRelativeLinearSurfaceVelocity
in interfaceConstContactSettings
- Returns:
- a new velocity vector (meters per second in system coordinates)
-