- add VehicleWheel.getDeltaRotation(), thanks to @niclas

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9060 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
nor..67 2012-01-15 17:46:47 +00:00
parent d918cefc17
commit 2511d6960e
4 changed files with 42 additions and 0 deletions

View File

@ -142,6 +142,22 @@ extern "C" {
return vehicle->getWheelInfo(wheelIndex).m_skidInfo;
}
/*
* Class: com_jme3_bullet_objects_VehicleWheel
* Method: getDeltaRotation
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getDeltaRotation
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex) {
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId);
if (vehicle == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return 0;
}
return vehicle->getWheelInfo(wheelIndex).m_deltaRotation;
}
#ifdef __cplusplus
}
#endif

View File

@ -55,6 +55,14 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNor
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo
(JNIEnv *, jobject, jlong, jint);
/*
* Class: com_jme3_bullet_objects_VehicleWheel
* Method: getDeltaRotation
* Signature: (JI)F
*/
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getDeltaRotation
(JNIEnv *, jobject, jlong, jint);
#ifdef __cplusplus
}
#endif

View File

@ -349,6 +349,16 @@ public class VehicleWheel implements Savable {
}
public native float getSkidInfo(long wheelId, int wheelIndex);
/**
* returns how many degrees the wheel has turned since the last physics
* step.
*/
public float getDeltaRotation() {
return getDeltaRotation(wheelId, wheelIndex);
}
public native float getDeltaRotation(long wheelId, int wheelIndex);
@Override
public void read(JmeImporter im) throws IOException {

View File

@ -331,6 +331,14 @@ public class VehicleWheel implements Savable {
public float getSkidInfo() {
return wheelInfo.skidInfo;
}
/**
* returns how many degrees the wheel has turned since the last physics
* step.
*/
public float getDeltaRotation() {
return wheelInfo.deltaRotation;
}
@Override
public void read(JmeImporter im) throws IOException {