Update to bullet 2.86.1 (#698)

fix-456
Riccardo Balbo 7 years ago committed by Rémy Bouquet
parent 02bc779866
commit af60797efd
  1. 4
      gradle.properties
  2. 2
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_PhysicsCollisionEvent.cpp
  3. 265
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsCharacter.cpp
  4. 136
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsCharacter.h
  5. 155
      jme3-bullet/src/main/java/com/jme3/bullet/objects/PhysicsCharacter.java

@ -19,8 +19,8 @@ buildAndroidExamples = false
ndkPath = /opt/android-ndk-r10c ndkPath = /opt/android-ndk-r10c
# Path for downloading native Bullet # Path for downloading native Bullet
bulletUrl = https://github.com/bulletphysics/bullet3/archive/2.83.7.zip bulletUrl = https://github.com/bulletphysics/bullet3/archive/2.86.1.zip
bulletFolder = bullet3-2.83.7 bulletFolder = bullet3-2.86.1
bulletZipFile = bullet3.zip bulletZipFile = bullet3.zip
# POM settings # POM settings

@ -209,7 +209,7 @@ JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_
env->ThrowNew(newExc, "The manifoldPoint does not exist."); env->ThrowNew(newExc, "The manifoldPoint does not exist.");
return 0; return 0;
} }
return mp -> m_lateralFrictionInitialized; return (mp -> m_contactPointFlags) & BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED;
} }
/* /*

@ -129,20 +129,100 @@ extern "C" {
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setUpAxis * Method: setUp
* Signature: (JI)V * Signature: (JLcom/jme3/math/Vector3f;)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setUpAxis JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setUp
(JNIEnv *env, jobject object, jlong objectId, jint value) { (JNIEnv *env, jobject object, jlong objectId, jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) { if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException"); jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist."); env->ThrowNew(newExc, "The native object does not exist.");
return; return;
} }
character->setUpAxis(value); btVector3 vec = btVector3();
jmeBulletUtil::convert(env, value, &vec);
character->setUp(vec);
} }
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setAngularVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setAngularVelocity
(JNIEnv *env, jobject object, jlong objectId, jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
btVector3 vec = btVector3();
jmeBulletUtil::convert(env, value, &vec);
character->setAngularVelocity(vec);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getAngularVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getAngularVelocity
(JNIEnv *env, jobject object, jlong objectId, jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
btVector3 a_vel = character->getAngularVelocity();
jmeBulletUtil::convert(env, &a_vel, value);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setLinearVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setLinearVelocity
(JNIEnv *env, jobject object, jlong objectId, jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
btVector3 vec = btVector3();
jmeBulletUtil::convert(env, value, &vec);
character->setLinearVelocity(vec);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getLinearVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getLinearVelocity
(JNIEnv *env, jobject object, jlong objectId, jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
btVector3 l_vel = character->getLinearVelocity();
jmeBulletUtil::convert(env, &l_vel, value);
}
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setFallSpeed * Method: setFallSpeed
@ -178,25 +258,96 @@ extern "C" {
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setGravity * Method: setGravity
* Signature: (JF)V * Signature: (JLcom/jme3/math/Vector3f;)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setGravity JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setGravity
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { (JNIEnv *env, jobject object, jlong objectId, jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) { if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException"); jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist."); env->ThrowNew(newExc, "The native object does not exist.");
return; return;
} }
character->setGravity(value);
btVector3 vec = btVector3();
jmeBulletUtil::convert(env, value, &vec);
character->setGravity(vec);
} }
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getGravity * Method: getGravity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getGravity
(JNIEnv *env, jobject object, jlong objectId,jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
btVector3 g = character->getGravity();
jmeBulletUtil::convert(env, &g, value);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setLinearDamping
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setLinearDamping
(JNIEnv *env, jobject object, jlong objectId,jfloat value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return ;
}
character->setLinearDamping(value);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getLinearDamping
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getLinearDamping
(JNIEnv *env, jobject object, jlong objectId) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return 0;
}
return character->getLinearDamping();
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setAngularDamping
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setAngularDamping
(JNIEnv *env, jobject object, jlong objectId,jfloat value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
character->setAngularDamping(value);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getAngularDamping
* Signature: (J)F * Signature: (J)F
*/ */
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getGravity JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getAngularDamping
(JNIEnv *env, jobject object, jlong objectId) { (JNIEnv *env, jobject object, jlong objectId) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) { if (character == NULL) {
@ -204,9 +355,44 @@ extern "C" {
env->ThrowNew(newExc, "The native object does not exist."); env->ThrowNew(newExc, "The native object does not exist.");
return 0; return 0;
} }
return character->getGravity(); return character->getAngularDamping();
} }
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setStepHeight
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setStepHeight
(JNIEnv *env, jobject object, jlong objectId,jfloat value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
character->setStepHeight(value);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getStepHeight
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getStepHeight
(JNIEnv *env, jobject object, jlong objectId) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return 0;
}
return character->getStepHeight();
}
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setMaxSlope * Method: setMaxSlope
@ -239,6 +425,39 @@ extern "C" {
return character->getMaxSlope(); return character->getMaxSlope();
} }
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setMaxPenetrationDepth
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setMaxPenetrationDepth
(JNIEnv *env, jobject object, jlong objectId, jfloat value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
character->setMaxPenetrationDepth(value);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getMaxPenetrationDepth
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getMaxPenetrationDepth
(JNIEnv *env, jobject object, jlong objectId) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return 0;
}
return character->getMaxPenetrationDepth();
}
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: onGround * Method: onGround
@ -258,17 +477,37 @@ extern "C" {
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: jump * Method: jump
* Signature: (J)V * Signature: (JLcom/jme3/math/Vector3f;)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_jump JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_jump
(JNIEnv *env, jobject object, jlong objectId) { (JNIEnv *env, jobject object, jlong objectId,jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
btVector3 vec = btVector3();
jmeBulletUtil::convert(env, value, &vec);
character->jump(vec);
}
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: applyImpulse
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_applyImpulse
(JNIEnv *env, jobject object, jlong objectId,jobject value) {
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId);
if (character == NULL) { if (character == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException"); jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist."); env->ThrowNew(newExc, "The native object does not exist.");
return; return;
} }
character->jump(); btVector3 vec = btVector3();
jmeBulletUtil::convert(env, value, &vec);
character->applyImpulse(vec);
} }
/* /*

@ -83,11 +83,47 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setWalkDire
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setUpAxis * Method: setUp
* Signature: (JI)V * Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setUp
(JNIEnv *, jobject , jlong , jobject );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setAngularVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setAngularVelocity
(JNIEnv *, jobject , jlong , jobject ) ;
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getAngularVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getAngularVelocity
(JNIEnv *, jobject , jlong , jobject );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setLinearVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setLinearVelocity
(JNIEnv *, jobject , jlong , jobject );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getLinearVelocity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setUpAxis JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getLinearVelocity
(JNIEnv *, jobject, jlong, jint); (JNIEnv *, jobject , jlong , jobject );
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
@ -108,18 +144,72 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setJumpSpee
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setGravity * Method: setGravity
* Signature: (JF)V * Signature: (JLcom/jme3/math/Vector3f;)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setGravity JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setGravity
(JNIEnv *, jobject, jlong, jfloat); (JNIEnv *, jobject, jlong, jobject);
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getGravity * Method: getGravity
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getGravity
(JNIEnv *, jobject, jlong, jobject);
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setLinearDamping
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setLinearDamping
(JNIEnv *, jobject , jlong ,jfloat );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getLinearDamping
* Signature: (J)F * Signature: (J)F
*/ */
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getGravity JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getLinearDamping
(JNIEnv *, jobject, jlong); (JNIEnv *, jobject , jlong );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setAngularDamping
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setAngularDamping
(JNIEnv *, jobject , jlong ,jfloat );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getAngularDamping
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getAngularDamping
(JNIEnv *, jobject , jlong );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setStepHeight
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setStepHeight
(JNIEnv *, jobject , jlong ,jfloat );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getStepHeight
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getStepHeight
(JNIEnv *, jobject , jlong );
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
@ -137,6 +227,24 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setMaxSlope
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getMaxSlope JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getMaxSlope
(JNIEnv *, jobject, jlong); (JNIEnv *, jobject, jlong);
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: setMaxPenetrationDepth
* Signature: (JF)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setMaxPenetrationDepth
(JNIEnv *, jobject , jlong , jfloat );
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: getMaxPenetrationDepth
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getMaxPenetrationDepth
(JNIEnv *, jobject , jlong );
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: onGround * Method: onGround
@ -148,10 +256,18 @@ JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_onGroun
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: jump * Method: jump
* Signature: (J)V * Signature: (JLcom/jme3/math/Vector3f;)V
*/ */
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_jump JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_jump
(JNIEnv *, jobject, jlong); (JNIEnv *, jobject, jlong, jobject);
/*
* Class: com_jme3_bullet_objects_PhysicsCharacter
* Method: applyImpulse
* Signature: (JLcom/jme3/math/Vector3f;)V
*/
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_applyImpulse
(JNIEnv *, jobject , jlong ,jobject );
/* /*
* Class: com_jme3_bullet_objects_PhysicsCharacter * Class: com_jme3_bullet_objects_PhysicsCharacter

@ -128,12 +128,64 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
return walkDirection; return walkDirection;
} }
/**
* @deprecated Deprecated in bullet 2.86.1 use setUp(Vector3f) instead
*/
@Deprecated
public void setUpAxis(int axis) { public void setUpAxis(int axis) {
upAxis = axis; if(axis<0) axis=0;
setUpAxis(characterId, axis); else if(axis>2) axis=2;
switch(axis){
case 0:
setUp(Vector3f.UNIT_X);
break;
case 1:
setUp(Vector3f.UNIT_Y);
break;
case 2:
setUp(Vector3f.UNIT_Z);
}
}
public void setUp(Vector3f axis) {
setUp(characterId, axis);
}
private native void setUp(long characterId, Vector3f axis);
public void setAngularVelocity(Vector3f v){
setAngularVelocity(characterId,v);
}
private native void setAngularVelocity(long characterId, Vector3f v);
public Vector3f getAngularVelocity(Vector3f out){
if(out==null)out=new Vector3f();
getAngularVelocity(characterId,out);
return out;
}
private native void getAngularVelocity(long characterId, Vector3f out);
public void setLinearVelocity(Vector3f v){
setLinearVelocity(characterId,v);
} }
private native void setUpAxis(long characterId, int axis); private native void setLinearVelocity(long characterId, Vector3f v);
public Vector3f getLinearVelocity(Vector3f out){
if(out==null)out=new Vector3f();
getLinearVelocity(characterId,out);
return out;
}
private native void getLinearVelocity(long characterId, Vector3f out);
public int getUpAxis() { public int getUpAxis() {
return upAxis; return upAxis;
@ -161,17 +213,95 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
return jumpSpeed; return jumpSpeed;
} }
/**
* @deprecated Deprecated in bullet 2.86.1. Use setGravity(Vector3f) instead.
*/
@Deprecated
public void setGravity(float value) { public void setGravity(float value) {
setGravity(new Vector3f(0,value,0));
}
public void setGravity(Vector3f value) {
setGravity(characterId, value); setGravity(characterId, value);
} }
private native void setGravity(long characterId, float gravity); private native void setGravity(long characterId, Vector3f gravity);
/**
* @deprecated Deprecated in bullet 2.86.1. Use getGravity(Vector3f) instead.
*/
@Deprecated
public float getGravity() { public float getGravity() {
return getGravity(characterId); return getGravity(null).y;
}
public Vector3f getGravity(Vector3f out) {
if(out==null)out=new Vector3f();
getGravity(characterId,out);
return out;
}
private native void getGravity(long characterId,Vector3f out);
public float getLinearDamping(){
return getLinearDamping(characterId);
}
private native float getLinearDamping(long characterId);
public void setLinearDamping(float v ){
setLinearDamping(characterId,v );
}
private native void setLinearDamping(long characterId,float v);
public float getAngularDamping(){
return getAngularDamping(characterId);
}
private native float getAngularDamping(long characterId);
public void setAngularDamping(float v ){
setAngularDamping(characterId,v );
}
private native void setAngularDamping(long characterId,float v);
public float getStepHeight(){
return getStepHeight(characterId);
}
private native float getStepHeight(long characterId);
public void setStepHeight(float v ){
setStepHeight(characterId,v );
}
private native void setStepHeight(long characterId,float v);
public float getMaxPenetrationDepth(){
return getMaxPenetrationDepth(characterId);
}
private native float getMaxPenetrationDepth(long characterId);
public void setMaxPenetrationDepth(float v ){
setMaxPenetrationDepth(characterId,v );
} }
private native float getGravity(long characterId); private native void setMaxPenetrationDepth(long characterId,float v);
public void setMaxSlope(float slopeRadians) { public void setMaxSlope(float slopeRadians) {
setMaxSlope(characterId, slopeRadians); setMaxSlope(characterId, slopeRadians);
@ -191,11 +321,20 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
private native boolean onGround(long characterId); private native boolean onGround(long characterId);
/**
* @deprecated Deprecated in bullet 2.86.1. Use jump(Vector3f) instead.
*/
@Deprecated
public void jump() { public void jump() {
jump(characterId); jump(Vector3f.UNIT_Y);
}
public void jump(Vector3f dir) {
jump(characterId,dir);
} }
private native void jump(long characterId); private native void jump(long characterId,Vector3f v);
@Override @Override
public void setCollisionShape(CollisionShape collisionShape) { public void setCollisionShape(CollisionShape collisionShape) {

Loading…
Cancel
Save