fix for issue #910: PhysicsCharacter incompatibilities
This commit is contained in:
parent
dae85e1598
commit
6ab7c0d91f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2018 jMonkeyEngine
|
* Copyright (c) 2009-2019 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -88,6 +88,12 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
|
|||||||
// }
|
// }
|
||||||
this.stepHeight = stepHeight;
|
this.stepHeight = stepHeight;
|
||||||
buildObject();
|
buildObject();
|
||||||
|
/*
|
||||||
|
* The default gravity for a Bullet btKinematicCharacterController
|
||||||
|
* is (0,0,-29.4), which makes no sense for JME.
|
||||||
|
* So override the default.
|
||||||
|
*/
|
||||||
|
setGravity(new Vector3f(0f, -29.4f, 0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,12 +295,12 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Deprecated in bullet 2.86.1. Use setGravity(Vector3f)
|
* @deprecated Deprecated in bullet 2.86.1. Use setGravity(Vector3f)
|
||||||
* instead.
|
* instead.
|
||||||
* @param value the desired upward component of the acceleration (typically
|
* @param value the desired downward (-Y) component of the acceleration
|
||||||
* negative)
|
* (typically positive)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setGravity(float value) {
|
public void setGravity(float value) {
|
||||||
setGravity(new Vector3f(0,value,0));
|
setGravity(new Vector3f(0, -value, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,11 +317,12 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
|
|||||||
/**
|
/**
|
||||||
* @deprecated Deprecated in bullet 2.86.1. Use getGravity(Vector3f)
|
* @deprecated Deprecated in bullet 2.86.1. Use getGravity(Vector3f)
|
||||||
* instead.
|
* instead.
|
||||||
* @return the upward component of the acceleration (typically negative)
|
* @return the downward (-Y) component of the acceleration (typically
|
||||||
|
* positive)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public float getGravity() {
|
public float getGravity() {
|
||||||
return getGravity(null).y;
|
return -getGravity(null).y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -488,10 +495,15 @@ public class PhysicsCharacter extends PhysicsCollisionObject {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void jump() {
|
public void jump() {
|
||||||
jump(Vector3f.UNIT_Y);
|
jump(Vector3f.ZERO);
|
||||||
|
/*
|
||||||
|
* The zero vector is treated as a special case
|
||||||
|
* by Bullet's btKinematicCharacterController::jump(),
|
||||||
|
* causing the character to jump in its "up" direction
|
||||||
|
* with the pre-set speed.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jump in the specified direction.
|
* Jump in the specified direction.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user