- native bullet: fix PhysicsVehicle wheel handling, using wheelIndex to select wheels now
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8480 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
62a02fb6f4
commit
768a2b9783
@ -67,7 +67,7 @@ public class PhysicsVehicle extends PhysicsRigidBody {
|
|||||||
|
|
||||||
protected long vehicleId = 0;
|
protected long vehicleId = 0;
|
||||||
protected long rayCasterId = 0;
|
protected long rayCasterId = 0;
|
||||||
protected VehicleTuning tuning;
|
protected VehicleTuning tuning = new VehicleTuning();
|
||||||
protected ArrayList<VehicleWheel> wheels = new ArrayList<VehicleWheel>();
|
protected ArrayList<VehicleWheel> wheels = new ArrayList<VehicleWheel>();
|
||||||
protected PhysicsSpace physicsSpace;
|
protected PhysicsSpace physicsSpace;
|
||||||
|
|
||||||
@ -110,9 +110,6 @@ public class PhysicsVehicle extends PhysicsRigidBody {
|
|||||||
@Override
|
@Override
|
||||||
protected void postRebuild() {
|
protected void postRebuild() {
|
||||||
super.postRebuild();
|
super.postRebuild();
|
||||||
if (tuning == null) {
|
|
||||||
tuning = new VehicleTuning();
|
|
||||||
}
|
|
||||||
motionState.setVehicle(this);
|
motionState.setVehicle(this);
|
||||||
createVehicle(physicsSpace);
|
createVehicle(physicsSpace);
|
||||||
}
|
}
|
||||||
@ -139,7 +136,7 @@ public class PhysicsVehicle extends PhysicsRigidBody {
|
|||||||
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Created Vehicle {0}", Long.toHexString(vehicleId));
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Created Vehicle {0}", Long.toHexString(vehicleId));
|
||||||
setCoordinateSystem(vehicleId, 0, 1, 2);
|
setCoordinateSystem(vehicleId, 0, 1, 2);
|
||||||
for (VehicleWheel wheel : wheels) {
|
for (VehicleWheel wheel : wheels) {
|
||||||
wheel.setWheelId(addWheel(vehicleId, wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), tuning, wheel.isFrontWheel()));
|
wheel.setVehicleId(vehicleId, addWheel(vehicleId, wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), tuning, wheel.isFrontWheel()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +146,7 @@ public class PhysicsVehicle extends PhysicsRigidBody {
|
|||||||
|
|
||||||
private native void setCoordinateSystem(long objectId, int a, int b, int c);
|
private native void setCoordinateSystem(long objectId, int a, int b, int c);
|
||||||
|
|
||||||
private native long addWheel(long objectId, Vector3f location, Vector3f direction, Vector3f axle, float restLength, float radius, VehicleTuning tuning, boolean frontWheel);
|
private native int addWheel(long objectId, Vector3f location, Vector3f direction, Vector3f axle, float restLength, float radius, VehicleTuning tuning, boolean frontWheel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a wheel to this vehicle
|
* Add a wheel to this vehicle
|
||||||
@ -191,7 +188,7 @@ public class PhysicsVehicle extends PhysicsRigidBody {
|
|||||||
wheel.setMaxSuspensionForce(tuning.maxSuspensionForce);
|
wheel.setMaxSuspensionForce(tuning.maxSuspensionForce);
|
||||||
wheels.add(wheel);
|
wheels.add(wheel);
|
||||||
if (vehicleId != 0) {
|
if (vehicleId != 0) {
|
||||||
wheel.setWheelId(addWheel(vehicleId, wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), tuning, wheel.isFrontWheel()));
|
wheel.setVehicleId(vehicleId, addWheel(vehicleId, wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), tuning, wheel.isFrontWheel()));
|
||||||
}
|
}
|
||||||
if (debugShape != null) {
|
if (debugShape != null) {
|
||||||
updateDebugShape();
|
updateDebugShape();
|
||||||
|
@ -52,6 +52,7 @@ import java.util.logging.Logger;
|
|||||||
public class VehicleWheel implements Savable {
|
public class VehicleWheel implements Savable {
|
||||||
|
|
||||||
protected long wheelId = 0;
|
protected long wheelId = 0;
|
||||||
|
protected int wheelIndex = 0;
|
||||||
protected boolean frontWheel;
|
protected boolean frontWheel;
|
||||||
protected Vector3f location = new Vector3f();
|
protected Vector3f location = new Vector3f();
|
||||||
protected Vector3f direction = new Vector3f();
|
protected Vector3f direction = new Vector3f();
|
||||||
@ -92,14 +93,14 @@ public class VehicleWheel implements Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void updatePhysicsState() {
|
public synchronized void updatePhysicsState() {
|
||||||
getWheelLocation(wheelId, wheelWorldLocation);
|
getWheelLocation(wheelId, wheelIndex, wheelWorldLocation);
|
||||||
getWheelRotation(wheelId, tmp_Matrix);
|
getWheelRotation(wheelId, wheelIndex, tmp_Matrix);
|
||||||
wheelWorldRotation.fromRotationMatrix(tmp_Matrix);
|
wheelWorldRotation.fromRotationMatrix(tmp_Matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void getWheelLocation(long wheelId, Vector3f location);
|
private native void getWheelLocation(long vehicleId, int wheelId, Vector3f location);
|
||||||
|
|
||||||
private native void getWheelRotation(long wheelId, Matrix3f location);
|
private native void getWheelRotation(long vehicleId, int wheelId, Matrix3f location);
|
||||||
|
|
||||||
public synchronized void applyWheelTransform() {
|
public synchronized void applyWheelTransform() {
|
||||||
if (wheelSpatial == null) {
|
if (wheelSpatial == null) {
|
||||||
@ -127,8 +128,9 @@ public class VehicleWheel implements Savable {
|
|||||||
return wheelId;
|
return wheelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWheelId(long wheelInfo) {
|
public void setVehicleId(long vehicleId, int wheelIndex) {
|
||||||
this.wheelId = wheelInfo;
|
this.wheelId = vehicleId;
|
||||||
|
this.wheelIndex = wheelIndex;
|
||||||
applyInfo();
|
applyInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,10 +260,10 @@ public class VehicleWheel implements Savable {
|
|||||||
if (wheelId == 0) {
|
if (wheelId == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
applyInfo(wheelId, suspensionStiffness, wheelsDampingRelaxation, wheelsDampingCompression, frictionSlip, rollInfluence, maxSuspensionTravelCm, maxSuspensionForce, radius, frontWheel, restLength);
|
applyInfo(wheelId, wheelIndex, suspensionStiffness, wheelsDampingRelaxation, wheelsDampingCompression, frictionSlip, rollInfluence, maxSuspensionTravelCm, maxSuspensionForce, radius, frontWheel, restLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void applyInfo(long wheelId,
|
private native void applyInfo(long wheelId, int wheelIndex,
|
||||||
float suspensionStiffness,
|
float suspensionStiffness,
|
||||||
float wheelsDampingRelaxation,
|
float wheelsDampingRelaxation,
|
||||||
float wheelsDampingCompression,
|
float wheelsDampingCompression,
|
||||||
@ -310,18 +312,18 @@ public class VehicleWheel implements Savable {
|
|||||||
* returns the location where the wheel collides with the ground (world space)
|
* returns the location where the wheel collides with the ground (world space)
|
||||||
*/
|
*/
|
||||||
public Vector3f getCollisionLocation(Vector3f vec) {
|
public Vector3f getCollisionLocation(Vector3f vec) {
|
||||||
getCollisionLocation(wheelId, vec);
|
getCollisionLocation(wheelId, wheelIndex, vec);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void getCollisionLocation(long wheelId, Vector3f vec);
|
private native void getCollisionLocation(long wheelId, int wheelIndex, Vector3f vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the location where the wheel collides with the ground (world space)
|
* returns the location where the wheel collides with the ground (world space)
|
||||||
*/
|
*/
|
||||||
public Vector3f getCollisionLocation() {
|
public Vector3f getCollisionLocation() {
|
||||||
Vector3f vec = new Vector3f();
|
Vector3f vec = new Vector3f();
|
||||||
getCollisionLocation(wheelId, vec);
|
getCollisionLocation(wheelId, wheelIndex, vec);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,18 +331,18 @@ public class VehicleWheel implements Savable {
|
|||||||
* returns the normal where the wheel collides with the ground (world space)
|
* returns the normal where the wheel collides with the ground (world space)
|
||||||
*/
|
*/
|
||||||
public Vector3f getCollisionNormal(Vector3f vec) {
|
public Vector3f getCollisionNormal(Vector3f vec) {
|
||||||
getCollisionNormal(wheelId, vec);
|
getCollisionNormal(wheelId, wheelIndex, vec);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void getCollisionNormal(long wheelId, Vector3f vec);
|
private native void getCollisionNormal(long wheelId, int wheelIndex, Vector3f vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the normal where the wheel collides with the ground (world space)
|
* returns the normal where the wheel collides with the ground (world space)
|
||||||
*/
|
*/
|
||||||
public Vector3f getCollisionNormal() {
|
public Vector3f getCollisionNormal() {
|
||||||
Vector3f vec = new Vector3f();
|
Vector3f vec = new Vector3f();
|
||||||
getCollisionNormal(wheelId, vec);
|
getCollisionNormal(wheelId, wheelIndex, vec);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,10 +351,10 @@ public class VehicleWheel implements Savable {
|
|||||||
* 0.0 = wheels are sliding, 1.0 = wheels have traction.
|
* 0.0 = wheels are sliding, 1.0 = wheels have traction.
|
||||||
*/
|
*/
|
||||||
public float getSkidInfo() {
|
public float getSkidInfo() {
|
||||||
return getSkidInfo(wheelId);
|
return getSkidInfo(wheelId, wheelIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public native float getSkidInfo(long wheelId);
|
public native float getSkidInfo(long wheelId, int wheelIndex);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(JmeImporter im) throws IOException {
|
public void read(JmeImporter im) throws IOException {
|
||||||
@ -421,5 +423,5 @@ public class VehicleWheel implements Savable {
|
|||||||
// finalizeNative(wheelId);
|
// finalizeNative(wheelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void finalizeNative(long wheelId);
|
private native void finalizeNative(long wheelId, int wheelIndex);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ extern "C" {
|
|||||||
* Method: addWheel
|
* Method: addWheel
|
||||||
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;FFLcom/jme3/bullet/objects/infos/VehicleTuning;Z)J
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;FFLcom/jme3/bullet/objects/infos/VehicleTuning;Z)J
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel
|
||||||
(JNIEnv *env, jobject object, jlong vehicleId, jobject location, jobject direction, jobject axle, jfloat restLength, jfloat radius, jobject tuning, jboolean frontWheel) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jobject location, jobject direction, jobject axle, jfloat restLength, jfloat radius, jobject tuning, jboolean frontWheel) {
|
||||||
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (vehicle == NULL) {
|
if (vehicle == NULL) {
|
||||||
@ -142,7 +142,8 @@ extern "C" {
|
|||||||
jmeBulletUtil::convert(env, axle, &vec3);
|
jmeBulletUtil::convert(env, axle, &vec3);
|
||||||
btRaycastVehicle::btVehicleTuning tune;
|
btRaycastVehicle::btVehicleTuning tune;
|
||||||
btWheelInfo* info = &vehicle->addWheel(vec1, vec2, vec3, restLength, radius, tune, frontWheel);
|
btWheelInfo* info = &vehicle->addWheel(vec1, vec2, vec3, restLength, radius, tune, frontWheel);
|
||||||
return (long) info;
|
int idx = vehicle->getNumWheels();
|
||||||
|
return idx-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -76,9 +76,9 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_setCoordinate
|
|||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_PhysicsVehicle
|
* Class: com_jme3_bullet_objects_PhysicsVehicle
|
||||||
* Method: addWheel
|
* Method: addWheel
|
||||||
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;FFLcom/jme3/bullet/objects/infos/VehicleTuning;Z)J
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;FFLcom/jme3/bullet/objects/infos/VehicleTuning;Z)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel
|
||||||
(JNIEnv *, jobject, jlong, jobject, jobject, jobject, jfloat, jfloat, jobject, jboolean);
|
(JNIEnv *, jobject, jlong, jobject, jobject, jobject, jfloat, jfloat, jobject, jboolean);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,14 +47,14 @@ extern "C" {
|
|||||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
* Signature: (JLcom/jme3/math/Vector3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelLocation
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelLocation
|
||||||
(JNIEnv *env, jobject object, jlong wheelId, jobject out) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) {
|
||||||
btWheelInfo* wheel = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (wheel == NULL) {
|
if (vehicle == 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;
|
||||||
}
|
}
|
||||||
jmeBulletUtil::convert(env, &wheel->m_worldTransform.getOrigin(), out);
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_worldTransform.getOrigin(), out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -63,14 +63,14 @@ extern "C" {
|
|||||||
* Signature: (JLcom/jme3/math/Matrix3f;)V
|
* Signature: (JLcom/jme3/math/Matrix3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelRotation
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelRotation
|
||||||
(JNIEnv *env, jobject object, jlong wheelId, jobject out) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) {
|
||||||
btWheelInfo* wheel = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (wheel == NULL) {
|
if (vehicle == 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;
|
||||||
}
|
}
|
||||||
jmeBulletUtil::convert(env, &wheel->m_worldTransform.getBasis(), out);
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_worldTransform.getBasis(), out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -79,18 +79,18 @@ extern "C" {
|
|||||||
* Signature: (JFFFFFFFFZF)V
|
* Signature: (JFFFFFFFFZF)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_applyInfo
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_applyInfo
|
||||||
(JNIEnv *env, jobject object, jlong wheelId, jfloat suspensionStiffness, jfloat wheelsDampingRelaxation, jfloat wheelsDampingCompression, jfloat frictionSlip, jfloat rollInfluence, jfloat maxSuspensionTravelCm, jfloat maxSuspensionForce, jfloat radius, jboolean frontWheel, jfloat restLength) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jfloat suspensionStiffness, jfloat wheelsDampingRelaxation, jfloat wheelsDampingCompression, jfloat frictionSlip, jfloat rollInfluence, jfloat maxSuspensionTravelCm, jfloat maxSuspensionForce, jfloat radius, jboolean frontWheel, jfloat restLength) {
|
||||||
btWheelInfo* wheelInfo = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
wheelInfo->m_suspensionStiffness = suspensionStiffness;
|
vehicle->getWheelInfo(wheelIndex).m_suspensionStiffness = suspensionStiffness;
|
||||||
wheelInfo->m_wheelsDampingRelaxation = wheelsDampingRelaxation;
|
vehicle->getWheelInfo(wheelIndex).m_wheelsDampingRelaxation = wheelsDampingRelaxation;
|
||||||
wheelInfo->m_wheelsDampingCompression = wheelsDampingCompression;
|
vehicle->getWheelInfo(wheelIndex).m_wheelsDampingCompression = wheelsDampingCompression;
|
||||||
wheelInfo->m_frictionSlip = frictionSlip;
|
vehicle->getWheelInfo(wheelIndex).m_frictionSlip = frictionSlip;
|
||||||
wheelInfo->m_rollInfluence = rollInfluence;
|
vehicle->getWheelInfo(wheelIndex).m_rollInfluence = rollInfluence;
|
||||||
wheelInfo->m_maxSuspensionTravelCm = maxSuspensionTravelCm;
|
vehicle->getWheelInfo(wheelIndex).m_maxSuspensionTravelCm = maxSuspensionTravelCm;
|
||||||
wheelInfo->m_maxSuspensionForce = maxSuspensionForce;
|
vehicle->getWheelInfo(wheelIndex).m_maxSuspensionForce = maxSuspensionForce;
|
||||||
wheelInfo->m_wheelsRadius = radius;
|
vehicle->getWheelInfo(wheelIndex).m_wheelsRadius = radius;
|
||||||
wheelInfo->m_bIsFrontWheel = frontWheel;
|
vehicle->getWheelInfo(wheelIndex).m_bIsFrontWheel = frontWheel;
|
||||||
wheelInfo->m_suspensionRestLength1 = restLength;
|
vehicle->getWheelInfo(wheelIndex).m_suspensionRestLength1 = restLength;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,14 +100,14 @@ extern "C" {
|
|||||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
* Signature: (JLcom/jme3/math/Vector3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionLocation
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionLocation
|
||||||
(JNIEnv *env, jobject object, jlong wheelId, jobject out) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) {
|
||||||
btWheelInfo* wheel = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (wheel == NULL) {
|
if (vehicle == 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;
|
||||||
}
|
}
|
||||||
jmeBulletUtil::convert(env, &wheel->m_raycastInfo.m_contactPointWS, out);
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_raycastInfo.m_contactPointWS, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -116,14 +116,14 @@ extern "C" {
|
|||||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
* Signature: (JLcom/jme3/math/Vector3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNormal
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNormal
|
||||||
(JNIEnv *env, jobject object, jlong wheelId, jobject out) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) {
|
||||||
btWheelInfo* wheel = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (wheel == NULL) {
|
if (vehicle == 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;
|
||||||
}
|
}
|
||||||
jmeBulletUtil::convert(env, &wheel->m_raycastInfo.m_contactNormalWS, out);
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_raycastInfo.m_contactNormalWS, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -132,25 +132,25 @@ extern "C" {
|
|||||||
* Signature: (J)F
|
* Signature: (J)F
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo
|
||||||
(JNIEnv *env, jobject object, jlong wheelId) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex) {
|
||||||
btWheelInfo* wheel = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (wheel == NULL) {
|
if (vehicle == 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 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return wheel->m_skidInfo;
|
return vehicle->getWheelInfo(wheelIndex).m_skidInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_finalizeNative
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_finalizeNative
|
||||||
(JNIEnv *env, jobject object, jlong wheelId) {
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex) {
|
||||||
btWheelInfo* wheel = (btWheelInfo*) wheelId;
|
btRaycastVehicle* vehicle = (btRaycastVehicle*) vehicleId;
|
||||||
if (wheel == NULL) {
|
if (vehicle == 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;
|
||||||
}
|
}
|
||||||
delete(wheel);
|
delete(&vehicle->getWheelInfo(wheelIndex));
|
||||||
}
|
}
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -10,58 +10,58 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: getWheelLocation
|
* Method: getWheelLocation
|
||||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
* Signature: (JILcom/jme3/math/Vector3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelLocation
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelLocation
|
||||||
(JNIEnv *, jobject, jlong, jobject);
|
(JNIEnv *, jobject, jlong, jint, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: getWheelRotation
|
* Method: getWheelRotation
|
||||||
* Signature: (JLcom/jme3/math/Matrix3f;)V
|
* Signature: (JILcom/jme3/math/Matrix3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelRotation
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelRotation
|
||||||
(JNIEnv *, jobject, jlong, jobject);
|
(JNIEnv *, jobject, jlong, jint, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: applyInfo
|
* Method: applyInfo
|
||||||
* Signature: (JFFFFFFFFZF)V
|
* Signature: (JIFFFFFFFFZF)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_applyInfo
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_applyInfo
|
||||||
(JNIEnv *, jobject, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jboolean, jfloat);
|
(JNIEnv *, jobject, jlong, jint, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jboolean, jfloat);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: getCollisionLocation
|
* Method: getCollisionLocation
|
||||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
* Signature: (JILcom/jme3/math/Vector3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionLocation
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionLocation
|
||||||
(JNIEnv *, jobject, jlong, jobject);
|
(JNIEnv *, jobject, jlong, jint, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: getCollisionNormal
|
* Method: getCollisionNormal
|
||||||
* Signature: (JLcom/jme3/math/Vector3f;)V
|
* Signature: (JILcom/jme3/math/Vector3f;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNormal
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNormal
|
||||||
(JNIEnv *, jobject, jlong, jobject);
|
(JNIEnv *, jobject, jlong, jint, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: getSkidInfo
|
* Method: getSkidInfo
|
||||||
* Signature: (J)F
|
* Signature: (JI)F
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo
|
||||||
(JNIEnv *, jobject, jlong);
|
(JNIEnv *, jobject, jlong, jint);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_jme3_bullet_objects_VehicleWheel
|
* Class: com_jme3_bullet_objects_VehicleWheel
|
||||||
* Method: finalizeNative
|
* Method: finalizeNative
|
||||||
* Signature: (J)V
|
* Signature: (JI)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_finalizeNative
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_finalizeNative
|
||||||
(JNIEnv *, jobject, jlong);
|
(JNIEnv *, jobject, jlong, jint);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user