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

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9060 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent d918cefc17
commit 2511d6960e
  1. 16
      engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.cpp
  2. 8
      engine/src/bullet-native/com_jme3_bullet_objects_VehicleWheel.h
  3. 10
      engine/src/bullet/com/jme3/bullet/objects/VehicleWheel.java
  4. 8
      engine/src/jbullet/com/jme3/bullet/objects/VehicleWheel.java

@ -142,6 +142,22 @@ extern "C" {
return vehicle->getWheelInfo(wheelIndex).m_skidInfo; 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 #ifdef __cplusplus
} }
#endif #endif

@ -55,6 +55,14 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNor
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo
(JNIEnv *, jobject, jlong, jint); (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 #ifdef __cplusplus
} }
#endif #endif

@ -350,6 +350,16 @@ public class VehicleWheel implements Savable {
public native float getSkidInfo(long wheelId, int wheelIndex); 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 @Override
public void read(JmeImporter im) throws IOException { public void read(JmeImporter im) throws IOException {
InputCapsule capsule = im.getCapsule(this); InputCapsule capsule = im.getCapsule(this);

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

Loading…
Cancel
Save