-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Body: add accessors for the collision group
- Loading branch information
1 parent
8a9391a
commit cd8ca27
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,13 @@ of this software and associated documentation files (the "Software"), to deal | |
* @author Stephen Gold [email protected] | ||
*/ | ||
public class Body extends NonCopyable implements ConstBody { | ||
// ************************************************************************* | ||
// fields | ||
|
||
/** | ||
* protect the collision group from garbage collection | ||
*/ | ||
private CollisionGroup group; | ||
// ************************************************************************* | ||
// constructors | ||
|
||
|
@@ -146,6 +153,15 @@ public void addTorque(Vec3Arg torque) { | |
addTorque(bodyVa, x, y, z); | ||
} | ||
|
||
/** | ||
* Access the body's collision group. | ||
* | ||
* @return the pre-existing group, or {@code null} if none | ||
*/ | ||
public CollisionGroup getCollisionGroup() { | ||
return group; | ||
} | ||
|
||
/** | ||
* Access the body's motion properties. | ||
* | ||
|
@@ -235,6 +251,18 @@ public void setAngularVelocityClamped(Vec3Arg omega) { | |
setAngularVelocityClamped(bodyVa, wx, wy, wz); | ||
} | ||
|
||
/** | ||
* Assign the body to the specified collision group. | ||
* | ||
* @param group the group to assign (not null, alias created) | ||
*/ | ||
public void setCollisionGroup(CollisionGroup group) { | ||
this.group = group; | ||
long bodyVa = va(); | ||
long groupVa = group.va(); | ||
setCollisionGroup(bodyVa, groupVa); | ||
} | ||
|
||
/** | ||
* Alter the body's friction ratio. | ||
* | ||
|
@@ -861,6 +889,8 @@ native private static void setAngularVelocity( | |
native private static void setAngularVelocityClamped( | ||
long bodyVa, float wx, float wy, float wz); | ||
|
||
native private static void setCollisionGroup(long bodyVa, long groupVa); | ||
|
||
native private static void setFriction(long bodyVa, float friction); | ||
|
||
native private static void setIsSensor(long bodyVa, boolean setting); | ||
|