java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Edge
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Join 2 soft-body vertices with a spring. (native type:
SoftBodySharedSettings::Edge
)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the inverse of the spring's stiffness.float
Return the rest length of the spring.int
getVertex
(int indexInEdge) Return the mesh vertex at the specified end.void
setCompliance
(float compliance) Alter the stiffness of the spring.void
setRestLength
(float length) Alter the rest length of the spring.void
setVertex
(int indexInEdge, int indexInMesh) Assign the specified mesh vertex to the edge.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
Edge
public Edge()Instantiate a default edge constraint.
-
-
Method Details
-
getCompliance
public float getCompliance()Return the inverse of the spring's stiffness. The edge is unaffected. (native attribute: mCompliance)- Returns:
- the compliance value
-
getRestLength
public float getRestLength()Return the rest length of the spring. The edge is unaffected. (native attribute: mRestLength)- Returns:
- the length (in meters)
-
getVertex
public int getVertex(int indexInEdge) Return the mesh vertex at the specified end. (native attribute: mVertex)- Parameters:
indexInEdge
- which end of the edge (0 or 1)- Returns:
- the mesh index of the vertex (≥0)
-
setCompliance
public void setCompliance(float compliance) Alter the stiffness of the spring. (native attribute: mCompliance)- Parameters:
compliance
- the inverse of the desired stiffness (default=0)
-
setRestLength
public void setRestLength(float length) Alter the rest length of the spring. (native attribute: mRestLength)- Parameters:
length
- the desired length (in meters, default=1)
-
setVertex
public void setVertex(int indexInEdge, int indexInMesh) Assign the specified mesh vertex to the edge. (native attribute: mVertex)- Parameters:
indexInEdge
- which end of the edge (0 or 1)indexInMesh
- the index of the vertex to assign (≥0)
-