added inertia manipulating methods
This commit is contained in:
parent
ec6c32ecdc
commit
96b355e38c
@ -151,6 +151,41 @@ extern "C" {
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: com_jme3_bullet_objects_PhysicsRigidBody
|
||||
* Method: setInverseInertiaLocal
|
||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setInverseInertiaLocal
|
||||
(JNIEnv *env, jobject object, jlong bodyId, jobject value) {
|
||||
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId);
|
||||
if (body == 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);
|
||||
body->setInvInertiaDiagLocal(vec);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jme3_bullet_objects_PhysicsRigidBody
|
||||
* Method: getInverseInertiaLocal
|
||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getInverseInertiaLocal
|
||||
(JNIEnv *env, jobject object, jlong bodyId, jobject value) {
|
||||
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId);
|
||||
if (body == NULL) {
|
||||
jclass newExc = env->FindClass("java/lang/NullPointerException");
|
||||
env->ThrowNew(newExc, "The native object does not exist.");
|
||||
return;
|
||||
}
|
||||
jmeBulletUtil::convert(env, &body->getInvInertiaDiagLocal(), value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jme3_bullet_objects_PhysicsRigidBody
|
||||
* Method: getPhysicsLocation
|
||||
|
@ -89,6 +89,14 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsR
|
||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsLocation
|
||||
(JNIEnv *, jobject, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_jme3_bullet_objects_PhysicsRigidBody
|
||||
* Method: getInverseInertiaLocal
|
||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getInverseInertiaLocal
|
||||
(JNIEnv *, jobject, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_jme3_bullet_objects_PhysicsRigidBody
|
||||
* Method: getPhysicsRotation
|
||||
|
@ -186,6 +186,21 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
|
||||
return rot;
|
||||
}
|
||||
|
||||
public void setInverseInertiaLocal(Vector3f gravity) {
|
||||
setInverseInertiaLocal(objectId, gravity);
|
||||
}
|
||||
private native void setInverseInertiaLocal(long objectId, Vector3f gravity);
|
||||
|
||||
public Vector3f getInverseInertiaLocal(Vector3f trans) {
|
||||
if (trans == null) {
|
||||
trans = new Vector3f();
|
||||
}
|
||||
getInverseInertiaLocal(objectId, trans);
|
||||
return trans;
|
||||
}
|
||||
|
||||
private native void getInverseInertiaLocal(long objectId, Vector3f vector);
|
||||
|
||||
private native void getPhysicsRotation(long objectId, Quaternion rot);
|
||||
|
||||
/**
|
||||
@ -352,7 +367,6 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
|
||||
public void setGravity(Vector3f gravity) {
|
||||
setGravity(objectId, gravity);
|
||||
}
|
||||
|
||||
private native void setGravity(long objectId, Vector3f gravity);
|
||||
|
||||
public float getFriction() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user