gun buildings fall on creation, dice stops correctly

This commit is contained in:
Philip Rosedale 2015-03-31 16:27:09 -07:00
parent f4695643e3
commit b7f0be761c
3 changed files with 10 additions and 6 deletions

View file

@ -282,7 +282,7 @@ function makePlatform(gravity, scale, size) {
z: pos.z - (separation * size / 2.0) + z * separation },
dimensions: dimensions,
color: { red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255 },
velocity: { x: 0, y: 0, z: 0 },
velocity: { x: 0, y: 0.05, z: 0 },
gravity: { x: 0, y: gravity, z: 0 },
lifetime: TARGET_LIFE,
damping: 0.1,
@ -297,7 +297,7 @@ function makePlatform(gravity, scale, size) {
type: "Box",
position: { x: pos.x, y: pos.y - separation / 2.0, z: pos.z },
dimensions: { x: 2.0 * separation * size, y: separation / 2.0, z: 2.0 * separation * size },
color: { red: 128, green: 128, blue: 128 },
color: { red: 100, green: 100, blue: 100 },
lifetime: TARGET_LIFE
});

View file

@ -92,7 +92,7 @@ function mousePressEvent(event) {
var clickedText = false;
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
if (clickedOverlay == offButton) {
deleteDice();
Script.stop();
} else if (clickedOverlay == diceButton) {
var HOW_HARD = 2.0;
var position = Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()));

View file

@ -212,6 +212,9 @@ btVector3 CharacterController::perpindicularComponent(const btVector3& direction
}
const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f);
const float DEFAULT_GRAVITY = 3.5f;
const float TERMINAL_VELOCITY = 55.0f;
const float JUMP_SPEED = 2.5f;
CharacterController::CharacterController(AvatarData* avatarData) {
assert(avatarData);
@ -226,9 +229,9 @@ CharacterController::CharacterController(AvatarData* avatarData) {
_velocityTimeInterval = 0.0f;
_verticalVelocity = 0.0f;
_verticalOffset = 0.0f;
_gravity = 5.0f; // slower than Earth's
_maxFallSpeed = 55.0f; // Terminal velocity of a sky diver in m/s.
_jumpSpeed = 5.0f;
_gravity = DEFAULT_GRAVITY; // slower than Earth's
_maxFallSpeed = TERMINAL_VELOCITY; // Terminal velocity of a sky diver in m/s.
_jumpSpeed = JUMP_SPEED;
_isOnGround = false;
_isJumping = false;
_isHovering = true;
@ -343,6 +346,7 @@ bool CharacterController::recoverFromPenetration(btCollisionWorld* collisionWorl
return penetration;
}
void CharacterController::scanDown(btCollisionWorld* world) {
// we test with downward raycast and if we don't find floor close enough then turn on "hover"
btKinematicClosestNotMeRayResultCallback callback(_ghostObject);