From 2511d6960ebf54f35c99e5d01bfbf134ed283db3 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Sun, 15 Jan 2012 17:46:47 +0000 Subject: [PATCH] - add VehicleWheel.getDeltaRotation(), thanks to @niclas git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9060 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com_jme3_bullet_objects_VehicleWheel.cpp | 16 ++++++++++++++++ .../com_jme3_bullet_objects_VehicleWheel.h | 8 ++++++++ .../com/jme3/bullet/objects/VehicleWheel.java | 10 ++++++++++ .../com/jme3/bullet/objects/VehicleWheel.java | 8 ++++++++ 4 files changed, 42 insertions(+) diff --git a/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.cpp b/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.cpp index e95bd6aca..f05e57fc3 100644 --- a/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.cpp +++ b/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.cpp @@ -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(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 diff --git a/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.h b/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.h index b3dad4bd7..f4ab208ae 100644 --- a/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.h +++ b/engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.h @@ -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 diff --git a/engine/src/bullet/com/jme3/bullet/objects/VehicleWheel.java b/engine/src/bullet/com/jme3/bullet/objects/VehicleWheel.java index 0da527e45..11eab6054 100644 --- a/engine/src/bullet/com/jme3/bullet/objects/VehicleWheel.java +++ b/engine/src/bullet/com/jme3/bullet/objects/VehicleWheel.java @@ -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 { diff --git a/engine/src/jbullet/com/jme3/bullet/objects/VehicleWheel.java b/engine/src/jbullet/com/jme3/bullet/objects/VehicleWheel.java index e6e7d63f4..7ac6bb022 100644 --- a/engine/src/jbullet/com/jme3/bullet/objects/VehicleWheel.java +++ b/engine/src/jbullet/com/jme3/bullet/objects/VehicleWheel.java @@ -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 {