implement contact-response for jme3-jbullet's PhysicsRigidBody
This commit is contained in:
parent
8d3980bbe9
commit
234bd476f3
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2018 jMonkeyEngine
|
* Copyright (c) 2009-2019 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -279,12 +279,17 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
|
|||||||
/**
|
/**
|
||||||
* Enable/disable this body's contact response.
|
* Enable/disable this body's contact response.
|
||||||
*
|
*
|
||||||
* @param newState true to respond to contacts (default=true)
|
* @param responsive true to respond to contacts, false to ignore them
|
||||||
|
* (default=true)
|
||||||
*/
|
*/
|
||||||
public void setContactResponse(boolean newState) {
|
public void setContactResponse(boolean responsive) {
|
||||||
if (!newState) {
|
int flags = rBody.getCollisionFlags();
|
||||||
throw new UnsupportedOperationException("Not implemented.");
|
if (responsive) {
|
||||||
|
flags &= ~CollisionFlags.NO_CONTACT_RESPONSE;
|
||||||
|
} else {
|
||||||
|
flags |= CollisionFlags.NO_CONTACT_RESPONSE;
|
||||||
}
|
}
|
||||||
|
rBody.setCollisionFlags(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,7 +298,9 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
|
|||||||
* @return true if responsive, otherwise false
|
* @return true if responsive, otherwise false
|
||||||
*/
|
*/
|
||||||
public boolean isContactResponse() {
|
public boolean isContactResponse() {
|
||||||
return true;
|
int flags = rBody.getCollisionFlags();
|
||||||
|
boolean result = (flags & CollisionFlags.NO_CONTACT_RESPONSE) == 0x0;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCcdSweptSphereRadius(float radius) {
|
public void setCcdSweptSphereRadius(float radius) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user