Merge pull request #6832 from AndrewMeadows/no-collisionsWillMove

namechange collisionsWillMove --> dynamic
This commit is contained in:
Seth Alves 2016-01-18 11:51:59 -08:00
commit 94bafb4a1e
93 changed files with 253 additions and 251 deletions

View file

@ -272,7 +272,7 @@ function loadBirds(howMany) {
gravity: { x: 0, y: BIRD_GRAVITY, z: 0 }, gravity: { x: 0, y: BIRD_GRAVITY, z: 0 },
velocity: { x: 0, y: -0.1, z: 0 }, velocity: { x: 0, y: -0.1, z: 0 },
damping: LINEAR_DAMPING, damping: LINEAR_DAMPING,
collisionsWillMove: true, dynamic: true,
lifetime: STARTING_LIFETIME, lifetime: STARTING_LIFETIME,
color: colors[whichBird] color: colors[whichBird]
}), }),
@ -289,4 +289,4 @@ function loadBirds(howMany) {
color: {red: 100, green: 100, blue: 100} color: {red: 100, green: 100, blue: 100}
}); });
} }
} }

View file

@ -53,7 +53,7 @@ for (var i = 0; i < NUM_MOONS; i++) {
dimensions: { x: radius, y: radius, z: radius }, dimensions: { x: radius, y: radius, z: radius },
color: color, color: color,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false dynamic: false
})); }));
} }

View file

@ -65,7 +65,7 @@
modelURL: BAT_MODEL, modelURL: BAT_MODEL,
position: dropPosition, position: dropPosition,
compoundShapeURL: BAT_COLLISION_HULL, compoundShapeURL: BAT_COLLISION_HULL,
collisionsWillMove: true, dynamic: true,
velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add velocity: { x: 0, y: 0.05, z: 0}, // workaround for gravity not taking effect on add
gravity: { x: 0, y: -9.81, z: 0}, gravity: { x: 0, y: -9.81, z: 0},
rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0), rotation: Quat.fromPitchYawRollDegrees(0.0, 0.0, -90.0),

View file

@ -107,7 +107,7 @@ var PITCHING_MACHINE_PROPERTIES = {
y: 0.61, y: 0.61,
z: 0.39 z: 0.39
}, },
collisionsWillMove: false, dynamic: false,
shapeType: "Box" shapeType: "Box"
}; };
PITCHING_MACHINE_PROPERTIES.dimensions = Vec3.multiply(2.5, PITCHING_MACHINE_PROPERTIES.dimensions); PITCHING_MACHINE_PROPERTIES.dimensions = Vec3.multiply(2.5, PITCHING_MACHINE_PROPERTIES.dimensions);
@ -217,7 +217,7 @@ var BASEBALL_PROPERTIES = {
y: BASEBALL_RADIUS, y: BASEBALL_RADIUS,
z: BASEBALL_RADIUS z: BASEBALL_RADIUS
}, },
collisionsWillMove: true, dynamic: true,
angularVelocity: { angularVelocity: {
x: 17.0, x: 17.0,
y: 0, y: 0,

View file

@ -104,7 +104,7 @@ function generateFloor() {
green: randFloat(70, 71), green: randFloat(70, 71),
blue: randFloat(70, 80) blue: randFloat(70, 80)
}, },
// collisionsWillMove: true // dynamic: true
})); }));
} }
@ -132,7 +132,7 @@ function dropBlock() {
shapeType: 'box', shapeType: 'box',
position: dropPos, position: dropPos,
dimensions: BLOCK_SIZE, dimensions: BLOCK_SIZE,
collisionsWillMove: true, dynamic: true,
gravity: { gravity: {
x: 0, x: 0,
y: -9, y: -9,
@ -198,4 +198,4 @@ function map(value, min1, max1, min2, max2) {
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);
Controller.mousePressEvent.connect(mousePressEvent); Controller.mousePressEvent.connect(mousePressEvent);

View file

@ -101,7 +101,7 @@ for (var i = 0; i < NUM_BLOCKS; i++) {
ignoreCollisions: false, ignoreCollisions: false,
damping: DAMPING, damping: DAMPING,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: true })); dynamic: true }));
} }
function scriptEnding() { function scriptEnding() {
@ -121,4 +121,4 @@ function scriptEnding() {
} }
} }
Script.scriptEnding.connect(scriptEnding); Script.scriptEnding.connect(scriptEnding);

View file

@ -234,7 +234,7 @@ function shootBullet(position, velocity, grenade) {
damping: 0.01, damping: 0.01,
density: 8000, density: 8000,
ignoreCollisions: false, ignoreCollisions: false,
collisionsWillMove: true dynamic: true
}); });
Script.addEventHandler(bulletID, "collisionWithEntity", entityCollisionWithEntity); Script.addEventHandler(bulletID, "collisionWithEntity", entityCollisionWithEntity);
@ -294,7 +294,7 @@ function shootTarget() {
rotation: Camera.getOrientation(), rotation: Camera.getOrientation(),
damping: 0.1, damping: 0.1,
density: 100.0, density: 100.0,
collisionsWillMove: true dynamic: true
}); });
// Record start time // Record start time
@ -349,7 +349,7 @@ function makeGrid(type, scale, size) {
rotation: Camera.getOrientation(), rotation: Camera.getOrientation(),
damping: 0.1, damping: 0.1,
density: 100.0, density: 100.0,
collisionsWillMove: true dynamic: true
}); });
} }
} }
@ -401,7 +401,7 @@ function makePlatform(gravity, scale, size) {
lifetime: TARGET_LIFE, lifetime: TARGET_LIFE,
damping: 0.1, damping: 0.1,
density: 100.0, density: 100.0,
collisionsWillMove: true dynamic: true
}); });
} }
} }

View file

@ -59,7 +59,7 @@ function createEntities() {
gravity: { x: 0, y: GRAVITY, z: 0 }, gravity: { x: 0, y: GRAVITY, z: 0 },
ignoreCollisions: false, ignoreCollisions: false,
damping: 0.50, damping: 0.50,
collisionsWillMove: true }); dynamic: true });
paddle = Entities.addEntity( paddle = Entities.addEntity(
{ type: "Box", { type: "Box",
@ -71,7 +71,7 @@ function createEntities() {
damping: 0.10, damping: 0.10,
visible: false, visible: false,
rotation : leftHanded ? MyAvatar.leftHandPose.rotation : MyAvatar.rightHandPose.rotation, rotation : leftHanded ? MyAvatar.leftHandPose.rotation : MyAvatar.rightHandPose.rotation,
collisionsWillMove: false }); dynamic: false });
modelURL = "http://public.highfidelity.io/models/attachments/pong_paddle.fbx"; modelURL = "http://public.highfidelity.io/models/attachments/pong_paddle.fbx";
paddleModel = Entities.addEntity( paddleModel = Entities.addEntity(
@ -84,7 +84,7 @@ function createEntities() {
modelURL: modelURL, modelURL: modelURL,
damping: 0.10, damping: 0.10,
rotation : leftHanded ? MyAvatar.leftHandPose.rotation : MyAvatar.rightHandPose.rotation, rotation : leftHanded ? MyAvatar.leftHandPose.rotation : MyAvatar.rightHandPose.rotation,
collisionsWillMove: false }); dynamic: false });
line = Overlays.addOverlay("line3d", { line = Overlays.addOverlay("line3d", {
start: { x: 0, y: 0, z: 0 }, start: { x: 0, y: 0, z: 0 },

View file

@ -154,7 +154,7 @@ function checkControllerSide(whichSide) {
dimensions: { x: BALL_RADIUS * 2, y: BALL_RADIUS * 2, z: BALL_RADIUS * 2 }, dimensions: { x: BALL_RADIUS * 2, y: BALL_RADIUS * 2, z: BALL_RADIUS * 2 },
damping: 0.00001, damping: 0.00001,
shapeType: "sphere", shapeType: "sphere",
collisionsWillMove: false, dynamic: false,
color: HELD_COLOR, color: HELD_COLOR,
lifetime: LIFETIME_SECONDS lifetime: LIFETIME_SECONDS
}; };
@ -200,7 +200,7 @@ function checkControllerSide(whichSide) {
velocity: linearVelocity, velocity: linearVelocity,
rotation: palmRotation, rotation: palmRotation,
angularVelocity: angularVelocity, angularVelocity: angularVelocity,
collisionsWillMove: true, dynamic: true,
color: THROWN_COLOR, color: THROWN_COLOR,
gravity: { x: 0, y: -GRAVITY_STRENGTH, z: 0}, gravity: { x: 0, y: -GRAVITY_STRENGTH, z: 0},
}; };

View file

@ -175,7 +175,7 @@ function createTable() {
damping: 0.1, damping: 0.1,
restitution: 0.01, restitution: 0.01,
density: 0.5, density: 0.5,
collisionsWillMove: true, dynamic: true,
color: { red: randInt(0, 255), green: randInt(0, 255), blue: randInt(0, 255) }, color: { red: randInt(0, 255), green: randInt(0, 255), blue: randInt(0, 255) },
}); });
if (type == "Model") { if (type == "Model") {
@ -196,4 +196,4 @@ function removeTable() {
} }
Script.scriptEnding.connect(cleanUp); Script.scriptEnding.connect(cleanUp);
Controller.mousePressEvent.connect(onClick); Controller.mousePressEvent.connect(onClick);

View file

@ -42,7 +42,7 @@ for (var x = 0; x < SIDE_SIZE; x++) {
dimensions: { x: radius, y: radius, z: radius }, dimensions: { x: radius, y: radius, z: radius },
color: color, color: color,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false, dynamic: false,
lifetime: LIFETIME lifetime: LIFETIME
})); }));
} }

View file

@ -51,7 +51,7 @@ function createEarth() {
z: EARTH_SPHERE_RADIUS z: EARTH_SPHERE_RADIUS
}, },
rotation: Quat.fromPitchYawRollDegrees(0, 90, 0), rotation: Quat.fromPitchYawRollDegrees(0, 90, 0),
// collisionsWillMove: true, // dynamic: true,
//if you have a shapetype it blocks the smaller markers //if you have a shapetype it blocks the smaller markers
// shapeType:'sphere' // shapeType:'sphere'
// userData: JSON.stringify({ // userData: JSON.stringify({

View file

@ -108,7 +108,7 @@ Script.setInterval(function() {
var grabData = userData["grabKey"] var grabData = userData["grabKey"]
// {"grabbableKey":{"invertSolidWhileHeld":true}, // {"grabbableKey":{"invertSolidWhileHeld":true},
// "grabKey":{"activated":true,"avatarId":"{6ea8b092-10e0-4058-888b-6facc40d0fe9}","refCount":1,"gravity":{"x":0,"y":0,"z":0},"ignoreForCollisions":0,"collisionsWillMove":1} // "grabKey":{"activated":true,"avatarId":"{6ea8b092-10e0-4058-888b-6facc40d0fe9}","refCount":1,"gravity":{"x":0,"y":0,"z":0},"ignoreForCollisions":0,"dynamic":1}
// } // }
if (typeof grabData != 'undefined') { if (typeof grabData != 'undefined') {

View file

@ -110,7 +110,7 @@ function shootDice(position, velocity) {
}, },
lifetime: LIFETIME, lifetime: LIFETIME,
shapeType: "box", shapeType: "box",
collisionsWillMove: true, dynamic: true,
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav" collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav"
})); }));
position = Vec3.sum(position, Vec3.multiply(DIE_SIZE, Vec3.normalize(Quat.getRight(Camera.getOrientation())))); position = Vec3.sum(position, Vec3.multiply(DIE_SIZE, Vec3.normalize(Quat.getRight(Camera.getOrientation()))));
@ -151,4 +151,4 @@ function scriptEnding() {
} }
Controller.mousePressEvent.connect(mousePressEvent); Controller.mousePressEvent.connect(mousePressEvent);
Script.scriptEnding.connect(scriptEnding); Script.scriptEnding.connect(scriptEnding);

View file

@ -77,7 +77,7 @@ Script.setInterval(function () {
damping: DAMPING, damping: DAMPING,
angularDamping: ANGULAR_DAMPING, angularDamping: ANGULAR_DAMPING,
gravity: (gravity ? GRAVITY : { x: 0, y: 0, z: 0}), gravity: (gravity ? GRAVITY : { x: 0, y: 0, z: 0}),
collisionsWillMove: collidable, dynamic: collidable,
lifetime: LIFETIME lifetime: LIFETIME
}); });

View file

@ -24,7 +24,7 @@ function createAvatarDetector() {
y: 2, y: 2,
z: 1 z: 1
}, },
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
visible: false, visible: false,
color: { color: {
@ -52,4 +52,4 @@ var cleanup = function() {
createAvatarDetector(); createAvatarDetector();
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);
Script.update.connect(updateAvatarDetector); Script.update.connect(updateAvatarDetector);

View file

@ -56,7 +56,7 @@ function explodeHelicopter(explodePosition) {
dimensions: partsURLS[i].dimensions, dimensions: partsURLS[i].dimensions,
position: position, position: position,
shapeType: "box", shapeType: "box",
collisionsWillMove: true, dynamic: true,
damping: 0, damping: 0,
gravity: { gravity: {
x: 0, x: 0,
@ -141,4 +141,4 @@ function cleanup() {
}) })
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);

View file

@ -90,7 +90,7 @@ var modelRatProperties = {
damping: 0.8, damping: 0.8,
angularDamping: 0.99, angularDamping: 0.99,
friction: 0.75, friction: 0.75,
collisionsWillMove: true, dynamic: true,
ignoreForCollisions: false, ignoreForCollisions: false,
gravity: { gravity: {
x: 0, x: 0,
@ -194,7 +194,7 @@ function addAvoiderBlock(position) {
z: 1 z: 1
}, },
position: position, position: position,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
visible: false visible: false
}; };
@ -468,4 +468,4 @@ if (USE_CONSTANT_SPAWNER === true) {
} }
}, RAT_SPAWN_RATE); }, RAT_SPAWN_RATE);
} }

View file

@ -165,7 +165,7 @@ function spawnBalls() {
blue: randFloat(10, 180) blue: randFloat(10, 180)
}, },
ignoreCollisions: false, ignoreCollisions: false,
collisionsWillMove: true, dynamic: true,
gravity: { gravity: {
x: 0, x: 0,
y: -9.9, y: -9.9,
@ -244,4 +244,4 @@ Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);
Controller.mousePressEvent.connect(mousePressEvent); Controller.mousePressEvent.connect(mousePressEvent);

View file

@ -43,7 +43,7 @@ function draw(deltaTime) {
var properties = { var properties = {
type: "Sphere", type: "Sphere",
collisionsWillMove: true, dynamic: true,
position: startPosition, position: startPosition,
dimensions: {x: largeRadius, y: largeRadius, z: largeRadius}, dimensions: {x: largeRadius, y: largeRadius, z: largeRadius},
registrationPoint: { x: 0.5, y: 0.5, z: 0.5 }, registrationPoint: { x: 0.5, y: 0.5, z: 0.5 },
@ -84,7 +84,7 @@ function draw(deltaTime) {
if (numberEntitiesAdded <= MAX_ENTITIES) { if (numberEntitiesAdded <= MAX_ENTITIES) {
var properties = { var properties = {
type: "Sphere", type: "Sphere",
collisionsWillMove: true, dynamic: true,
position: center, position: center,
dimensions: {x: entitySize, y: entitySize, z: entitySize}, dimensions: {x: entitySize, y: entitySize, z: entitySize},
registrationPoint: { x: 0.5, y: 0.5, z: 0.5 }, registrationPoint: { x: 0.5, y: 0.5, z: 0.5 },

View file

@ -19,7 +19,7 @@ var position = Vec3.sum(MyAvatar.position, Quat.getFront(MyAvatar.orientation));
var properties = { var properties = {
type: "Box", type: "Box",
position: position, position: position,
collisionsWillMove: true, dynamic: true,
color: { red: 200, green: 0, blue: 0 } color: { red: 200, green: 0, blue: 0 }
}; };
var collider = Entities.addEntity(properties); var collider = Entities.addEntity(properties);

View file

@ -177,7 +177,7 @@ function makeNewProp(which, position) {
damping: PUCK_DAMPING, damping: PUCK_DAMPING,
angularDamping: ANGULAR_DAMPING, angularDamping: ANGULAR_DAMPING,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: true dynamic: true
}); });
} else if (which == "paddle1") { } else if (which == "paddle1") {
paddle1Pos = Vec3.sum(center, { paddle1Pos = Vec3.sum(center, {
@ -211,7 +211,7 @@ function makeNewProp(which, position) {
damping: PADDLE_DAMPING, damping: PADDLE_DAMPING,
angularDamping: PADDLE_ANGULAR_DAMPING, angularDamping: PADDLE_ANGULAR_DAMPING,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: true dynamic: true
}); });
} else if (which == "paddle2") { } else if (which == "paddle2") {
paddle2Pos = Vec3.sum(center, { paddle2Pos = Vec3.sum(center, {
@ -245,7 +245,7 @@ function makeNewProp(which, position) {
damping: PADDLE_DAMPING, damping: PADDLE_DAMPING,
angularDamping: PADDLE_ANGULAR_DAMPING, angularDamping: PADDLE_ANGULAR_DAMPING,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: true dynamic: true
}); });
} }
} }

View file

@ -128,7 +128,7 @@ function makeBalls(pos) {
damping: 0.50, damping: 0.50,
shapeType: "sphere", shapeType: "sphere",
collisionSoundURL: hitSound, collisionSoundURL: hitSound,
collisionsWillMove: true })); dynamic: true }));
ballPosition.z += (BALL_SIZE + BALL_GAP) * SCALE; ballPosition.z += (BALL_SIZE + BALL_GAP) * SCALE;
ballNumber++; ballNumber++;
} }
@ -149,7 +149,7 @@ function makeBalls(pos) {
ignoreCollisions: false, ignoreCollisions: false,
damping: 0.50, damping: 0.50,
shapeType: "sphere", shapeType: "sphere",
collisionsWillMove: true }); dynamic: true });
} }
@ -184,7 +184,7 @@ function shootCue(velocity) {
damping: 0.10, damping: 0.10,
density: 8000, density: 8000,
ignoreCollisions: false, ignoreCollisions: false,
collisionsWillMove: true dynamic: true
}); });
print("Shot, velocity = " + velocity); print("Shot, velocity = " + velocity);
} }

View file

@ -219,7 +219,7 @@
type: 'Box', type: 'Box',
dimensions: COLOR_INDICATOR_DIMENSIONS, dimensions: COLOR_INDICATOR_DIMENSIONS,
position: this.currentProperties.position, position: this.currentProperties.position,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true ignoreForCollisions: true
} }
@ -262,4 +262,4 @@
}; };
return new ColorBusterWand(); return new ColorBusterWand();
}); });

View file

@ -81,7 +81,7 @@ function createColorBusterCube(row, column, vertical) {
name: 'Hifi-ColorBusterCube', name: 'Hifi-ColorBusterCube',
type: 'Box', type: 'Box',
dimensions: CUBE_DIMENSIONS, dimensions: CUBE_DIMENSIONS,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: false, ignoreForCollisions: false,
color: startingColor[1], color: startingColor[1],
position: position, position: position,
@ -127,4 +127,4 @@ if (DELETE_AT_ENDING === true) {
} }
createBoard(); createBoard();

View file

@ -71,7 +71,7 @@ function createColorBusterWand() {
dimensions: COLOR_WAND_DIMENSIONS, dimensions: COLOR_WAND_DIMENSIONS,
position: center, position: center,
script: COLOR_WAND_SCRIPT_URL, script: COLOR_WAND_SCRIPT_URL,
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
hifiColorBusterWandKey: { hifiColorBusterWandKey: {
owner: MyAvatar.sessionUUID, owner: MyAvatar.sessionUUID,
@ -96,4 +96,4 @@ if (DELETE_AT_ENDING === true) {
Script.scriptEnding.connect(deleteWand); Script.scriptEnding.connect(deleteWand);
} }
createColorBusterWand(); createColorBusterWand();

View file

@ -169,8 +169,8 @@ function fire(side, value) {
if (intersection.intersects) { if (intersection.intersects) {
Script.setTimeout(function() { Script.setTimeout(function() {
createEntityHitEffect(intersection.intersection); createEntityHitEffect(intersection.intersection);
if (shootAnything && intersection.properties.collisionsWillMove === 1) { if (shootAnything && intersection.properties.dynamic === 1) {
// Any entity with collisions will move can be shot // Any dynamic entity can be shot
Entities.editEntity(intersection.entityID, { Entities.editEntity(intersection.entityID, {
velocity: Vec3.multiply(shotDirection, GUN_FORCE) velocity: Vec3.multiply(shotDirection, GUN_FORCE)
}); });

View file

@ -142,7 +142,7 @@ function mousePressEvent(event) {
if (!pickResults.intersects) { if (!pickResults.intersects) {
return; return;
} }
if (pickResults.properties.collisionsWillMove) { if (pickResults.properties.dynamic) {
grabbedEntity = pickResults.entityID; grabbedEntity = pickResults.entityID;
var props = Entities.getEntityProperties(grabbedEntity) var props = Entities.getEntityProperties(grabbedEntity)
originalGravity = props.gravity; originalGravity = props.gravity;

View file

@ -190,7 +190,7 @@ function controller(side) {
direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition)) direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition))
}; };
var intersection = getRayIntersection(pickRay, true); var intersection = getRayIntersection(pickRay, true);
if (intersection.intersects && intersection.properties.collisionsWillMove) { if (intersection.intersects && intersection.properties.dynamic) {
this.laserWasHovered = true; this.laserWasHovered = true;
if (this.triggerHeld && !this.grabbing) { if (this.triggerHeld && !this.grabbing) {
this.grab(intersection.entityID); this.grab(intersection.entityID);
@ -298,4 +298,4 @@ var leftController = new controller(LEFT);
Script.update.connect(update); Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding); Script.scriptEnding.connect(scriptEnding);

View file

@ -49,7 +49,7 @@ function mousePressEvent(event) {
dimensions: {x: 0.3, y: 0.7, z: 0.3}, dimensions: {x: 0.3, y: 0.7, z: 0.3},
gravity: {x: 0.0, y: -3.0, z: 0.0}, gravity: {x: 0.0, y: -3.0, z: 0.0},
damping: 0.2, damping: 0.2,
collisionsWillMove: true dynamic: true
}); });
var pointToOffsetFrom = Vec3.sum(position, {x: 0.0, y: 2.0, z: 0.0}); var pointToOffsetFrom = Vec3.sum(position, {x: 0.0, y: 2.0, z: 0.0});

View file

@ -289,7 +289,7 @@ PlankyStack = function() {
} }
if (!editMode) { if (!editMode) {
_this.planks.forEach(function(plank, index, object) { _this.planks.forEach(function(plank, index, object) {
Entities.editEntity(plank.entity, {ignoreForCollisions: false, collisionsWillMove: true}); Entities.editEntity(plank.entity, {ignoreForCollisions: false, dynamic: true});
}); });
} }
}; };

View file

@ -67,7 +67,7 @@ SatelliteCreator = function() {
damping: 0.0, damping: 0.0,
ignoreCollisions: false, ignoreCollisions: false,
lifetime: 6000, lifetime: 6000,
collisionsWillMove: false, dynamic: false,
visible: true visible: true
}); });
@ -90,7 +90,7 @@ SatelliteCreator = function() {
damping: 0.0, damping: 0.0,
ignoreCollisions: false, ignoreCollisions: false,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: false, dynamic: false,
visible: true visible: true
}); });
@ -174,7 +174,7 @@ SatelliteCreator = function() {
damping: 0.0, damping: 0.0,
ignoreCollisions: false, ignoreCollisions: false,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: false, dynamic: false,
}); });
this.getProperties = function() { this.getProperties = function() {

View file

@ -191,7 +191,7 @@ function initializeInvaders() {
dimensions: { x: invaderSize * 2, y: invaderSize * 2, z: invaderSize * 2 }, dimensions: { x: invaderSize * 2, y: invaderSize * 2, z: invaderSize * 2 },
color: { red: 255, green: 0, blue: 0 }, color: { red: 255, green: 0, blue: 0 },
modelURL: invaderModels[row].modelURL, modelURL: invaderModels[row].modelURL,
collisionsWillMove: true, dynamic: true,
lifetime: itemLifetimes lifetime: itemLifetimes
}); });
} }
@ -341,7 +341,7 @@ function fireMissile() {
velocity: { x: 0, y: 5, z: 0}, velocity: { x: 0, y: 5, z: 0},
gravity: { x: 0, y: 0, z: 0 }, gravity: { x: 0, y: 0, z: 0 },
damping: 0, damping: 0,
collisionsWillMove: true, dynamic: true,
dimensions: { x: missileSize, y: missileSize, z: missileSize }, dimensions: { x: missileSize, y: missileSize, z: missileSize },
color: { red: 0, green: 0, blue: 255 }, color: { red: 0, green: 0, blue: 255 },
lifetime: 5 lifetime: 5

View file

@ -286,7 +286,7 @@ function makeSword() {
damping: 0.1, damping: 0.1,
collisionSoundURL: swordCollisionSoundURL, collisionSoundURL: swordCollisionSoundURL,
restitution: 0.01, restitution: 0.01,
collisionsWillMove: true, dynamic: true,
}); });
if (originalAvatarCollisionSound === undefined) { if (originalAvatarCollisionSound === undefined) {

View file

@ -30,7 +30,7 @@ ColorCube.prototype.create = function() {
name: that.NAME, name: that.NAME,
color: that.COLOR, color: that.COLOR,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false, dynamic: false,
dimensions: { x: size, y: size, z: size }, dimensions: { x: size, y: size, z: size },
lifetime: 3600, lifetime: 3600,
userData: JSON.stringify(that.USER_DATA) userData: JSON.stringify(that.USER_DATA)

View file

@ -55,7 +55,7 @@ CreateSimulation = function() {
damping: DAMPING, damping: DAMPING,
ignoreCollisions: false, ignoreCollisions: false,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: false dynamic: false
}); });
@ -187,7 +187,7 @@ CreateSimulation = function() {
damping: DAMPING, damping: DAMPING,
ignoreCollisions: false, ignoreCollisions: false,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: false, dynamic: false,
}); });
this.computeAcceleration = function() { this.computeAcceleration = function() {

View file

@ -37,7 +37,7 @@ function makeAll() {
type: "Model", type: "Model",
modelURL: HIFI_PUBLIC_BUCKET + model, modelURL: HIFI_PUBLIC_BUCKET + model,
collisionSoundURL: sound, collisionSoundURL: sound,
collisionsWillMove: true, dynamic: true,
shapeType: "box", shapeType: "box",
restitution: 0.8, restitution: 0.8,
dimensions: currentDimensions, dimensions: currentDimensions,

View file

@ -46,7 +46,7 @@ ArcBall = function(spawnPosition) {
}, },
ignoreForCollisions: true, ignoreForCollisions: true,
damping: 0.8, damping: 0.8,
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
spatialKey: { spatialKey: {
@ -142,4 +142,4 @@ ArcBall = function(spawnPosition) {
} }
this.cleanup = cleanup; this.cleanup = cleanup;
} }

View file

@ -41,7 +41,7 @@ LightBall = function(spawnPosition) {
green: 10, green: 10,
blue: 150 blue: 150
}, },
collisionsWillMove: true, dynamic: true,
// gravity: { // gravity: {
// x: 0, // x: 0,
// y: -0.5, // y: -0.5,

View file

@ -23,7 +23,7 @@ LightSaber = function(spawnPosition) {
modelURL: modelURL, modelURL: modelURL,
position: spawnPosition, position: spawnPosition,
shapeType: 'box', shapeType: 'box',
collisionsWillMove: true, dynamic: true,
script: scriptURL, script: scriptURL,
dimensions: { dimensions: {
x: 0.06, x: 0.06,

View file

@ -33,7 +33,7 @@ RaveStick = function(spawnPosition) {
modelURL: modelURL, modelURL: modelURL,
position: spawnPosition, position: spawnPosition,
shapeType: 'box', shapeType: 'box',
collisionsWillMove: true, dynamic: true,
script: scriptURL, script: scriptURL,
dimensions: { dimensions: {
x: 0.06, x: 0.06,

View file

@ -320,7 +320,7 @@ Grabber.prototype.pressEvent = function(event) {
return; return;
} }
if (!pickResults.properties.collisionsWillMove) { if (!pickResults.properties.dynamic) {
// only grab dynamic objects // only grab dynamic objects
return; return;
} }
@ -510,7 +510,7 @@ Grabber.prototype.activateEntity = function(entityID, grabbedProperties) {
if (data["refCount"] == 1) { if (data["refCount"] == 1) {
data["gravity"] = grabbedProperties.gravity; data["gravity"] = grabbedProperties.gravity;
data["ignoreForCollisions"] = grabbedProperties.ignoreForCollisions; data["ignoreForCollisions"] = grabbedProperties.ignoreForCollisions;
data["collisionsWillMove"] = grabbedProperties.collisionsWillMove; data["dynamic"] = grabbedProperties.dynamic;
var whileHeldProperties = {gravity: {x:0, y:0, z:0}}; var whileHeldProperties = {gravity: {x:0, y:0, z:0}};
if (invertSolidWhileHeld) { if (invertSolidWhileHeld) {
whileHeldProperties["ignoreForCollisions"] = ! grabbedProperties.ignoreForCollisions; whileHeldProperties["ignoreForCollisions"] = ! grabbedProperties.ignoreForCollisions;
@ -528,7 +528,7 @@ Grabber.prototype.deactivateEntity = function(entityID) {
Entities.editEntity(entityID, { Entities.editEntity(entityID, {
gravity: data["gravity"], gravity: data["gravity"],
ignoreForCollisions: data["ignoreForCollisions"], ignoreForCollisions: data["ignoreForCollisions"],
collisionsWillMove: data["collisionsWillMove"] dynamic: data["dynamic"]
}); });
data = null; data = null;
} }

View file

@ -52,7 +52,7 @@ function makeGrenade() {
dimensions: { x: 0.09, dimensions: { x: 0.09,
y: 0.20, y: 0.20,
z: 0.09 }, z: 0.09 },
collisionsWillMove: true, dynamic: true,
modelURL: grenadeURL, modelURL: grenadeURL,
shapeType: "box" shapeType: "box"
}); });
@ -160,7 +160,7 @@ function blowShitUp(position, radius) {
var SPIN_RATE = 20.0; var SPIN_RATE = 20.0;
for (var i = 0; i < stuff.length; i++) { for (var i = 0; i < stuff.length; i++) {
var properties = Entities.getEntityProperties(stuff[i]); var properties = Entities.getEntityProperties(stuff[i]);
if (properties.collisionsWillMove) { if (properties.dynamic) {
var diff = Vec3.subtract(properties.position, position); var diff = Vec3.subtract(properties.position, position);
var distance = Vec3.length(diff); var distance = Vec3.length(diff);
var velocity = Vec3.sum(properties.velocity, Vec3.multiply(STRENGTH * 1.0 / distance, Vec3.normalize(diff))); var velocity = Vec3.sum(properties.velocity, Vec3.multiply(STRENGTH * 1.0 / distance, Vec3.normalize(diff)));

View file

@ -46,7 +46,7 @@ Script.setInterval(function () {
position: position, position: position,
dimensions: MODEL_DIMENSION, dimensions: MODEL_DIMENSION,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false, dynamic: false,
lifetime: LIFETIME lifetime: LIFETIME
}); });
} else { } else {
@ -57,7 +57,7 @@ Script.setInterval(function () {
dimensions: { x: SIZE, y: SIZE, z: SIZE }, dimensions: { x: SIZE, y: SIZE, z: SIZE },
color: { red: x / ROWS_X * 255, green: 50, blue: z / ROWS_Z * 255 }, color: { red: x / ROWS_X * 255, green: 50, blue: z / ROWS_Z * 255 },
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false, dynamic: false,
lifetime: LIFETIME lifetime: LIFETIME
}); });
} }

View file

@ -25,7 +25,7 @@ ball = Entities.addEntity(
position: basePosition, position: basePosition,
dimensions: { x: 0.1, y: 0.1, z: 0.1 }, dimensions: { x: 0.1, y: 0.1, z: 0.1 },
color: { red: 255, green: 0, blue: 255 }, color: { red: 255, green: 0, blue: 255 },
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true ignoreForCollisions: true
}); });

View file

@ -262,7 +262,7 @@
var elDensity = document.getElementById("property-density"); var elDensity = document.getElementById("property-density");
var elIgnoreForCollisions = document.getElementById("property-ignore-for-collisions"); var elIgnoreForCollisions = document.getElementById("property-ignore-for-collisions");
var elCollisionsWillMove = document.getElementById("property-collisions-will-move"); var elDynamic = document.getElementById("property-dyanmic" );
var elCollisionSoundURL = document.getElementById("property-collision-sound-url"); var elCollisionSoundURL = document.getElementById("property-collision-sound-url");
var elLifetime = document.getElementById("property-lifetime"); var elLifetime = document.getElementById("property-lifetime");
var elScriptURL = document.getElementById("property-script-url"); var elScriptURL = document.getElementById("property-script-url");
@ -492,7 +492,7 @@
elDensity.value = properties.density.toFixed(2); elDensity.value = properties.density.toFixed(2);
elIgnoreForCollisions.checked = properties.ignoreForCollisions; elIgnoreForCollisions.checked = properties.ignoreForCollisions;
elCollisionsWillMove.checked = properties.collisionsWillMove; elDynamic.checked = properties.dynamic;
elCollisionSoundURL.value = properties.collisionSoundURL; elCollisionSoundURL.value = properties.collisionSoundURL;
elLifetime.value = properties.lifetime; elLifetime.value = properties.lifetime;
elScriptURL.value = properties.script; elScriptURL.value = properties.script;
@ -719,7 +719,7 @@
elDensity.addEventListener('change', createEmitNumberPropertyUpdateFunction('density')); elDensity.addEventListener('change', createEmitNumberPropertyUpdateFunction('density'));
elIgnoreForCollisions.addEventListener('change', createEmitCheckedPropertyUpdateFunction('ignoreForCollisions')); elIgnoreForCollisions.addEventListener('change', createEmitCheckedPropertyUpdateFunction('ignoreForCollisions'));
elCollisionsWillMove.addEventListener('change', createEmitCheckedPropertyUpdateFunction('collisionsWillMove')); elDynamic.addEventListener('change', createEmitCheckedPropertyUpdateFunction('dynamic'));
elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL')); elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL'));
elLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifetime')); elLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifetime'));
@ -1242,9 +1242,9 @@
</div> </div>
<div class="property"> <div class="property">
<span class="label">Collisions Will Move</span> <span class="label">Dynamic</span>
<span class="value"> <span class="value">
<input type='checkbox' id="property-collisions-will-move"> <input type='checkbox' id="property-dynamic">
</span> </span>
</div> </div>

View file

@ -75,7 +75,7 @@ var playerSphere = Entities.addEntity({
y: -9.8, y: -9.8,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
damping: 0.2 damping: 0.2
}); });
@ -267,4 +267,4 @@ function cleanup() {
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);

View file

@ -201,7 +201,7 @@ EntityPropertyDialogBox = (function () {
index++; index++;
array.push({ label: "Ignore for Collisions:", type: "checkbox", value: properties.ignoreForCollisions }); array.push({ label: "Ignore for Collisions:", type: "checkbox", value: properties.ignoreForCollisions });
index++; index++;
array.push({ label: "Collisions Will Move:", type: "checkbox", value: properties.collisionsWillMove }); array.push({ label: "Dynamic:", type: "checkbox", value: properties.dynamic });
index++; index++;
array.push({ label: "Collision Sound URL:", value: properties.collisionSoundURL }); array.push({ label: "Collision Sound URL:", value: properties.collisionSoundURL });
index++; index++;
@ -413,7 +413,7 @@ EntityPropertyDialogBox = (function () {
index++; // skip header index++; // skip header
properties.density = array[index++].value; properties.density = array[index++].value;
properties.ignoreForCollisions = array[index++].value; properties.ignoreForCollisions = array[index++].value;
properties.collisionsWillMove = array[index++].value; properties.dynamic = array[index++].value;
properties.lifetime = array[index++].value; properties.lifetime = array[index++].value;
properties.visible = array[index++].value; properties.visible = array[index++].value;

View file

@ -227,7 +227,7 @@ entitySlider.prototype = {
type: 'Line', type: 'Line',
name: 'Hifi-Slider-Axis::' + this.sliderType, name: 'Hifi-Slider-Axis::' + this.sliderType,
color: this.color, color: this.color,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
dimensions: { dimensions: {
x: 3, x: 3,
@ -250,7 +250,7 @@ entitySlider.prototype = {
var properties = { var properties = {
name: 'Hifi-End-Of-Axis', name: 'Hifi-End-Of-Axis',
type: 'Box', type: 'Box',
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
dimensions: { dimensions: {
x: 0.01, x: 0.01,
@ -360,7 +360,7 @@ entitySlider.prototype = {
type: 'Sphere', type: 'Sphere',
name: 'Hifi-Slider-' + this.sliderType, name: 'Hifi-Slider-' + this.sliderType,
dimensions: SLIDER_DIMENSIONS, dimensions: SLIDER_DIMENSIONS,
collisionsWillMove: true, dynamic: true,
color: this.color, color: this.color,
position: sliderPosition, position: sliderPosition,
script: SLIDER_SCRIPT_URL, script: SLIDER_SCRIPT_URL,
@ -558,7 +558,7 @@ function createPanelEntity(position) {
z: 0.1 z: 0.1
}, },
visible: false, visible: false,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true ignoreForCollisions: true
} }
@ -582,7 +582,7 @@ function createVisiblePanel() {
z: SLIDER_DIMENSIONS.z / 4 z: SLIDER_DIMENSIONS.z / 4
}, },
visible: true, visible: true,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
position: moveDown, position: moveDown,
rotation: avatarRot, rotation: avatarRot,
@ -602,7 +602,7 @@ function createLightModel(position, rotation) {
shapeType: 'box', shapeType: 'box',
modelURL: LIGHT_MODEL_URL, modelURL: LIGHT_MODEL_URL,
dimensions: LIGHT_MODEL_DIMENSIONS, dimensions: LIGHT_MODEL_DIMENSIONS,
collisionsWillMove: true, dynamic: true,
position: position, position: position,
rotation: rotation, rotation: rotation,
script: PARENT_SCRIPT_URL, script: PARENT_SCRIPT_URL,
@ -639,7 +639,7 @@ function createCloseButton(axisStart) {
position: Vec3.sum(position, VERTICAL_OFFFSET), position: Vec3.sum(position, VERTICAL_OFFFSET),
rotation: Quat.multiply(avatarRot, Quat.fromPitchYawRollDegrees(90, 0, 45)), rotation: Quat.multiply(avatarRot, Quat.fromPitchYawRollDegrees(90, 0, 45)),
//rotation: Quat.fromPitchYawRollDegrees(0, 0, 90), //rotation: Quat.fromPitchYawRollDegrees(0, 0, 90),
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
script: CLOSE_BUTTON_SCRIPT_URL, script: CLOSE_BUTTON_SCRIPT_URL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -873,4 +873,4 @@ subscribeToCleanupMessages();
// linearAttenuation: 0, // linearAttenuation: 0,
// quadraticAttenuation: 0, // quadraticAttenuation: 0,
// exponent: 0, // exponent: 0,
// cutoff: 180, // in degrees // cutoff: 180, // in degrees

View file

@ -42,7 +42,7 @@ for (var i = 0; i < NUM_BLOCKS; i++) {
z: basePosition.z + randFloat(-SPAWN_RANGE, SPAWN_RANGE) z: basePosition.z + randFloat(-SPAWN_RANGE, SPAWN_RANGE)
}, },
color: {red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255}, color: {red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255},
collisionsWillMove: true, dynamic: true,
gravity: {x: 0, y: 0, z: 0} gravity: {x: 0, y: 0, z: 0}
})); }));
} }
@ -60,4 +60,4 @@ Script.scriptEnding.connect(cleanup);
function randFloat(low, high) { function randFloat(low, high) {
return low + Math.random() * ( high - low ); return low + Math.random() * ( high - low );
} }

View file

@ -39,7 +39,7 @@ BALL_PROTOTYPE = {
dimensions: BALL_DIMENSIONS, dimensions: BALL_DIMENSIONS,
color: BALL_COLOR, color: BALL_COLOR,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false dynamic: false
}; };
// 2 millimeters // 2 millimeters
@ -62,7 +62,7 @@ LINE_PROTOTYPE = {
lineWidth: 5, lineWidth: 5,
visible: true, visible: true,
ignoreCollisions: true, ignoreCollisions: true,
collisionsWillMove: false, dynamic: false,
} }
EDGE_PROTOTYPE = LINE_PROTOTYPE; EDGE_PROTOTYPE = LINE_PROTOTYPE;
@ -76,7 +76,7 @@ EDGE_PROTOTYPE = LINE_PROTOTYPE;
// rotation: rotation, // rotation: rotation,
// visible: true, // visible: true,
// ignoreCollisions: true, // ignoreCollisions: true,
// collisionsWillMove: false // dynamic: false
// } // }

View file

@ -9,7 +9,7 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
/*global window, alert, EventBridge, dat, convertBinaryToBoolean, listenForSettingsUpdates,createVec3Folder,createQuatFolder,writeVec3ToInterface,writeDataToInterface*/ /*global window, alert, EventBridge, dat, listenForSettingsUpdates,createVec3Folder,createQuatFolder,writeVec3ToInterface,writeDataToInterface*/
var Settings = function() { var Settings = function() {
this.exportSettings = function() { this.exportSettings = function() {
@ -66,7 +66,7 @@ var keysToIgnore = [
'angularVelocity', 'angularVelocity',
'angularDamping', 'angularDamping',
'ignoreForCollisions', 'ignoreForCollisions',
'collisionsWillMove', 'dynamic',
'href', 'href',
'actionData', 'actionData',
'marketplaceID', 'marketplaceID',
@ -502,11 +502,3 @@ function registerDOMElementsForListenerBlocking() {
}); });
} }
///utility method for converting weird collisionWillMove type propertyies from binary to new Boolean()
//
// function convertBinaryToBoolean(value) {
// if (value === 0) {
// return false;
// }
// return true;
// }

View file

@ -58,7 +58,7 @@ for (var i = 0; i < planetTypes.length; i++) {
angularDamping: 0.0, angularDamping: 0.0,
ignoreCollisions: false, ignoreCollisions: false,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: false })); dynamic: false }));
} }
Script.setTimeout(createParticles, 1000); Script.setTimeout(createParticles, 1000);
@ -82,7 +82,7 @@ function createParticles() {
ignoreCollisions: false, ignoreCollisions: false,
damping: DAMPING, damping: DAMPING,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: true })); dynamic: true }));
} }
Script.update.connect(update); Script.update.connect(update);
} }

View file

@ -113,7 +113,7 @@ function spawnBoxes() {
collisionSoundURL: collisionSoundURL, collisionSoundURL: collisionSoundURL,
shapeType: "box", shapeType: "box",
position: position, position: position,
collisionsWillMove: true, dynamic: true,
dimensions: {x: 1, y: 2, z: 3}, dimensions: {x: 1, y: 2, z: 3},
velocity: {x: 0, y: -.01, z: 0}, velocity: {x: 0, y: -.01, z: 0},
gravity: {x: 0, y: -2.5 - Math.random() * 6, z: 0} gravity: {x: 0, y: -2.5 - Math.random() * 6, z: 0}

View file

@ -148,7 +148,7 @@ for (var i = 0; i < NUM_BALLS; i++) {
ignoreCollisions: false, ignoreCollisions: false,
damping: DAMPING, damping: DAMPING,
lifetime: LIFETIME, lifetime: LIFETIME,
collisionsWillMove: true })); dynamic: true }));
} }
var VEL_MAG = 2.0; var VEL_MAG = 2.0;

View file

@ -37,7 +37,7 @@ function makeNewStick() {
damping: .1, damping: .1,
collisionSoundURL: "http://public.highfidelity.io/sounds/Collisions-hitsandslaps/67LCollision07.wav", collisionSoundURL: "http://public.highfidelity.io/sounds/Collisions-hitsandslaps/67LCollision07.wav",
restitution: 0.01, restitution: 0.01,
collisionsWillMove: true dynamic: true
}); });
actionID = Entities.addAction("hold", stickID, actionID = Entities.addAction("hold", stickID,
{relativePosition: {x: 0.0, y: 0.0, z: -0.5}, {relativePosition: {x: 0.0, y: 0.0, z: -0.5},

View file

@ -37,7 +37,7 @@ function makeNewStick() {
damping: .1, damping: .1,
collisionSoundURL: "http://public.highfidelity.io/sounds/Collisions-hitsandslaps/67LCollision07.wav", collisionSoundURL: "http://public.highfidelity.io/sounds/Collisions-hitsandslaps/67LCollision07.wav",
restitution: 0.01, restitution: 0.01,
collisionsWillMove: true dynamic: true
}); });
actionID = Entities.addAction("hold", stickID, {relativePosition: {x: 0.0, y: 0.0, z: -0.9}, actionID = Entities.addAction("hold", stickID, {relativePosition: {x: 0.0, y: 0.0, z: -0.9},
hand: hand, hand: hand,

View file

@ -47,7 +47,7 @@ var rack = Entities.addEntity({
y: 1.37, y: 1.37,
z: 1.73 z: 1.73
}, },
collisionsWillMove: true, dynamic: true,
ignoreForCollisions: false, ignoreForCollisions: false,
collisionSoundURL: collisionSoundURL, collisionSoundURL: collisionSoundURL,
compoundShapeURL: rackCollisionHullURL, compoundShapeURL: rackCollisionHullURL,
@ -89,7 +89,7 @@ function createBalls() {
y: -9.8, y: -9.8,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
ignoreForCollisions: false, ignoreForCollisions: false,
modelURL: basketballURL, modelURL: basketballURL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -150,4 +150,4 @@ function atEnd() {
Script.clearInterval(distanceCheckInterval); Script.clearInterval(distanceCheckInterval);
} }
Script.scriptEnding.connect(atEnd); Script.scriptEnding.connect(atEnd);

View file

@ -42,7 +42,7 @@ function makeBasketball() {
y: DIAMETER, y: DIAMETER,
z: DIAMETER z: DIAMETER
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: collisionSoundURL, collisionSoundURL: collisionSoundURL,
modelURL: basketballURL, modelURL: basketballURL,
restitution: 1.0, restitution: 1.0,
@ -94,4 +94,4 @@ function deleteStuff() {
} }
Script.update.connect(update); Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding); Script.scriptEnding.connect(scriptEnding);

View file

@ -90,7 +90,7 @@ var topBlock = Entities.addEntity({
rotation: topBlock_rotation, rotation: topBlock_rotation,
damping: LINEAR_DAMPING, damping: LINEAR_DAMPING,
gravity: BLOCK_GRAVITY, gravity: BLOCK_GRAVITY,
collisionsWillMove: true, dynamic: true,
velocity: { velocity: {
x: 0, x: 0,
y: -0.01, y: -0.01,
@ -108,7 +108,7 @@ var sideBlock1 = Entities.addEntity({
rotation: sideBlock1_rotation, rotation: sideBlock1_rotation,
damping: LINEAR_DAMPING, damping: LINEAR_DAMPING,
gravity: BLOCK_GRAVITY, gravity: BLOCK_GRAVITY,
collisionsWillMove: true dynamic: true
}); });
var sideBlock2 = Entities.addEntity({ var sideBlock2 = Entities.addEntity({
@ -119,10 +119,10 @@ var sideBlock2 = Entities.addEntity({
dimensions: blockDimensions, dimensions: blockDimensions,
position: sideBlock2_position, position: sideBlock2_position,
rotation: sideBlock2_rotation, rotation: sideBlock2_rotation,
collsionsWillMove: true, dynamic: true,
damping: LINEAR_DAMPING, damping: LINEAR_DAMPING,
gravity: BLOCK_GRAVITY, gravity: BLOCK_GRAVITY,
collisionsWillMove: true dynamic: true
}); });
var ground = Entities.addEntity({ var ground = Entities.addEntity({

View file

@ -234,7 +234,7 @@
compoundShapeURL: ARROW_COLLISION_HULL_URL, compoundShapeURL: ARROW_COLLISION_HULL_URL,
dimensions: ARROW_DIMENSIONS, dimensions: ARROW_DIMENSIONS,
position: this.bowProperties.position, position: this.bowProperties.position,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
collisionSoundURL: ARROW_HIT_SOUND_URL, collisionSoundURL: ARROW_HIT_SOUND_URL,
damping: 0.01, damping: 0.01,
@ -264,7 +264,7 @@
z: 0 z: 0
}, },
position: collision.contactPoint, position: collision.contactPoint,
collisionsWillMove: false dynamic: false
}) })
// print('ARROW COLLIDED WITH::' + entityB); // print('ARROW COLLIDED WITH::' + entityB);
Script.removeEventHandler(arrow, "collisionWithEntity", makeArrowStick) Script.removeEventHandler(arrow, "collisionWithEntity", makeArrowStick)
@ -286,7 +286,7 @@
type: 'Line', type: 'Line',
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET), position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
dimensions: LINE_DIMENSIONS, dimensions: LINE_DIMENSIONS,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
@ -304,7 +304,7 @@
type: 'Line', type: 'Line',
position: Vec3.sum(this.bowProperties.position, BOTTOM_NOTCH_OFFSET), position: Vec3.sum(this.bowProperties.position, BOTTOM_NOTCH_OFFSET),
dimensions: LINE_DIMENSIONS, dimensions: LINE_DIMENSIONS,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
@ -389,7 +389,7 @@
position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET), position: Vec3.sum(this.bowProperties.position, TOP_NOTCH_OFFSET),
dimensions: LINE_DIMENSIONS, dimensions: LINE_DIMENSIONS,
visible: true, visible: true,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
@ -538,7 +538,7 @@
//make the arrow physical, give it gravity, a lifetime, and set our velocity //make the arrow physical, give it gravity, a lifetime, and set our velocity
var arrowProperties = { var arrowProperties = {
collisionsWillMove: true, dynamic: true,
ignoreForCollisions: false, ignoreForCollisions: false,
collisionMask: "static,dynamic,otherAvatar", // workaround: not with kinematic --> no collision with bow collisionMask: "static,dynamic,otherAvatar", // workaround: not with kinematic --> no collision with bow
velocity: releaseVelocity, velocity: releaseVelocity,

View file

@ -39,7 +39,7 @@ var bow = Entities.addEntity({
modelURL: MODEL_URL, modelURL: MODEL_URL,
position: center, position: center,
dimensions: BOW_DIMENSIONS, dimensions: BOW_DIMENSIONS,
collisionsWillMove: true, dynamic: true,
gravity: BOW_GRAVITY, gravity: BOW_GRAVITY,
shapeType: 'compound', shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
@ -68,4 +68,4 @@ function cleanup() {
Entities.deleteEntity(bow); Entities.deleteEntity(bow);
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);

View file

@ -41,7 +41,7 @@ var wand = Entities.addEntity({
z: 0.05 z: 0.05
}, },
//must be enabled to be grabbable in the physics engine //must be enabled to be grabbable in the physics engine
collisionsWillMove: true, dynamic: true,
compoundShapeURL: WAND_COLLISION_SHAPE, compoundShapeURL: WAND_COLLISION_SHAPE,
script: WAND_SCRIPT_URL, script: WAND_SCRIPT_URL,
userData: JSON.stringify({ userData: JSON.stringify({

View file

@ -71,7 +71,7 @@
addCollisionsToBubbleAfterCreation: function(bubble) { addCollisionsToBubbleAfterCreation: function(bubble) {
//if the bubble collide immediately, we get weird effects. so we add collisions after release //if the bubble collide immediately, we get weird effects. so we add collisions after release
Entities.editEntity(bubble, { Entities.editEntity(bubble, {
collisionsWillMove: true dynamic: true
}); });
}, },
randomizeBubbleGravity: function() { randomizeBubbleGravity: function() {
@ -161,7 +161,7 @@
modelURL: BUBBLE_MODEL, modelURL: BUBBLE_MODEL,
position: this.getWandTipPosition(properties), position: this.getWandTipPosition(properties),
dimensions: BUBBLE_INITIAL_DIMENSIONS, dimensions: BUBBLE_INITIAL_DIMENSIONS,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
damping: BUBBLE_LINEAR_DAMPING, damping: BUBBLE_LINEAR_DAMPING,
shapeType: "sphere" shapeType: "sphere"
@ -198,4 +198,4 @@
return new BubbleWand(); return new BubbleWand();
}); });

View file

@ -47,7 +47,7 @@ function createDoll() {
y: 0, y: 0,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
invertSolidWhileHeld: true invertSolidWhileHeld: true
@ -57,4 +57,4 @@ function createDoll() {
return doll; return doll;
} }
createDoll(); createDoll();

View file

@ -33,7 +33,7 @@ var flashlight = Entities.addEntity({
y: 0.30, y: 0.30,
z: 0.08 z: 0.08
}, },
collisionsWillMove: true, dynamic: true,
shapeType: 'box', shapeType: 'box',
script: scriptURL, script: scriptURL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -41,4 +41,4 @@ var flashlight = Entities.addEntity({
invertSolidWhileHeld: true invertSolidWhileHeld: true
} }
}) })
}); });

View file

@ -34,7 +34,7 @@ var pingPongGun = Entities.addEntity({
y: 0.21, y: 0.21,
z: 0.47 z: 0.47
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: COLLISION_SOUND_URL, collisionSoundURL: COLLISION_SOUND_URL,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
@ -54,4 +54,4 @@ var pingPongGun = Entities.addEntity({
function cleanUp() { function cleanUp() {
Entities.deleteEntity(pingPongGun); Entities.deleteEntity(pingPongGun);
} }
Script.scriptEnding.connect(cleanUp); Script.scriptEnding.connect(cleanUp);

View file

@ -55,7 +55,7 @@ var targetIntervalClearer = Entities.addEntity({
}, },
rotation: rotation, rotation: rotation,
visible: false, visible: false,
collisionsWillMove: false, dynamic: false,
ignoreForCollisions: true, ignoreForCollisions: true,
}); });
@ -89,7 +89,7 @@ function addTargets() {
type: 'Model', type: 'Model',
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType: 'compound',
collisionsWillMove: true, dynamic: true,
dimensions: TARGET_DIMENSIONS, dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
position: position, position: position,
@ -122,7 +122,7 @@ function testTargetDistanceFromStart() {
type: 'Model', type: 'Model',
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType: 'compound',
collisionsWillMove: true, dynamic: true,
dimensions: TARGET_DIMENSIONS, dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
position: originalPositions[index], position: originalPositions[index],
@ -167,4 +167,4 @@ function atEnd() {
deleteTargets(); deleteTargets();
} }
Script.scriptEnding.connect(atEnd); Script.scriptEnding.connect(atEnd);

View file

@ -126,7 +126,7 @@
damping: BALL_LINEAR_DAMPING, damping: BALL_LINEAR_DAMPING,
gravity: BALL_GRAVITY, gravity: BALL_GRAVITY,
restitution: BALL_RESTITUTION, restitution: BALL_RESTITUTION,
collisionsWillMove: true, dynamic: true,
rotation: gunProperties.rotation, rotation: gunProperties.rotation,
position: this.getGunTipPosition(gunProperties), position: this.getGunTipPosition(gunProperties),
velocity: forwardVec, velocity: forwardVec,

View file

@ -19,7 +19,7 @@ var pistol = Entities.addEntity({
blue: 20 blue: 20
}, },
shapeType: 'box', shapeType: 'box',
collisionsWillMove: true, dynamic: true,
gravity: {x: 0, y: -5.0, z: 0}, gravity: {x: 0, y: -5.0, z: 0},
restitution: 0, restitution: 0,
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav", collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
@ -43,4 +43,4 @@ function cleanup() {
Entities.deleteEntity(pistol); Entities.deleteEntity(pistol);
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);

View file

@ -153,8 +153,8 @@
}); });
}, randFloat(10, 200)); }, randFloat(10, 200));
} }
if (intersection.properties.collisionsWillMove === 1) { if (intersection.properties.dynamic === 1) {
// Any entity with collisions will move can be shot // Any dynaic entity can be shot
Entities.editEntity(intersection.entityID, { Entities.editEntity(intersection.entityID, {
velocity: Vec3.multiply(this.firingDirection, this.bulletForce) velocity: Vec3.multiply(this.firingDirection, this.bulletForce)
}); });
@ -359,4 +359,4 @@
// entity scripts always need to return a newly constructed object of our type // entity scripts always need to return a newly constructed object of our type
return new Pistol(); return new Pistol();
}); });

View file

@ -62,7 +62,7 @@ function initMonsters() {
y: 1.6, y: 1.6,
z: 0.07 z: 0.07
}, },
collisionsWillMove: true, dynamic: true,
shapeType: 'box', shapeType: 'box',
velocity: { velocity: {
x: randFloat(1, 3), x: randFloat(1, 3),
@ -114,4 +114,4 @@ function cleanup() {
}); });
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);

View file

@ -37,7 +37,7 @@
modelURL: MODEL_URL, modelURL: MODEL_URL,
position: MyAvatar.position, position: MyAvatar.position,
dimensions: {x: 0.04, y: 1.3, z: 0.21}, dimensions: {x: 0.04, y: 1.3, z: 0.21},
collisionsWillMove: true, dynamic: true,
gravity: {x: 0, y: 0, z: 0}, gravity: {x: 0, y: 0, z: 0},
shapeType: 'compound', shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,

View file

@ -157,7 +157,7 @@ var onTargetHit = function(targetEntity, projectileEntity, collision) {
parentID: targetEntity parentID: targetEntity
}); });
Entities.editEntity(targetEntity, { Entities.editEntity(targetEntity, {
collisionsWillMove: true, dynamic: true,
gravity: {x: 0, y: GRAVITY, z: 0}, gravity: {x: 0, y: GRAVITY, z: 0},
velocity: {x: 0, y: -0.01, z: 0} velocity: {x: 0, y: -0.01, z: 0}
}); });

View file

@ -41,7 +41,7 @@ void AvatarMotionState::clearIncomingDirtyFlags() {
} }
} }
MotionType AvatarMotionState::computeObjectMotionType() const { PhysicsMotionType AvatarMotionState::computePhysicsMotionType() const {
// TODO?: support non-DYNAMIC motion for avatars? (e.g. when sitting) // TODO?: support non-DYNAMIC motion for avatars? (e.g. when sitting)
return MOTION_TYPE_DYNAMIC; return MOTION_TYPE_DYNAMIC;
} }

View file

@ -22,12 +22,12 @@ class AvatarMotionState : public ObjectMotionState {
public: public:
AvatarMotionState(Avatar* avatar, btCollisionShape* shape); AvatarMotionState(Avatar* avatar, btCollisionShape* shape);
virtual MotionType getMotionType() const override { return _motionType; } virtual PhysicsMotionType getMotionType() const override { return _motionType; }
virtual uint32_t getIncomingDirtyFlags() override; virtual uint32_t getIncomingDirtyFlags() override;
virtual void clearIncomingDirtyFlags() override; virtual void clearIncomingDirtyFlags() override;
virtual MotionType computeObjectMotionType() const override; virtual PhysicsMotionType computePhysicsMotionType() const override;
virtual bool isMoving() const override; virtual bool isMoving() const override;

View file

@ -65,7 +65,7 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
_visible(ENTITY_ITEM_DEFAULT_VISIBLE), _visible(ENTITY_ITEM_DEFAULT_VISIBLE),
_ignoreForCollisions(ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS), _ignoreForCollisions(ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS),
_collisionMask(ENTITY_COLLISION_MASK_DEFAULT), _collisionMask(ENTITY_COLLISION_MASK_DEFAULT),
_collisionsWillMove(ENTITY_ITEM_DEFAULT_COLLISIONS_WILL_MOVE), _dynamic(ENTITY_ITEM_DEFAULT_DYNAMIC),
_locked(ENTITY_ITEM_DEFAULT_LOCKED), _locked(ENTITY_ITEM_DEFAULT_LOCKED),
_userData(ENTITY_ITEM_DEFAULT_USER_DATA), _userData(ENTITY_ITEM_DEFAULT_USER_DATA),
_simulationOwner(), _simulationOwner(),
@ -125,7 +125,7 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
requestedProperties += PROP_VISIBLE; requestedProperties += PROP_VISIBLE;
requestedProperties += PROP_IGNORE_FOR_COLLISIONS; requestedProperties += PROP_IGNORE_FOR_COLLISIONS;
requestedProperties += PROP_COLLISION_MASK; requestedProperties += PROP_COLLISION_MASK;
requestedProperties += PROP_COLLISIONS_WILL_MOVE; requestedProperties += PROP_DYNAMIC;
requestedProperties += PROP_LOCKED; requestedProperties += PROP_LOCKED;
requestedProperties += PROP_USER_DATA; requestedProperties += PROP_USER_DATA;
requestedProperties += PROP_MARKETPLACE_ID; requestedProperties += PROP_MARKETPLACE_ID;
@ -262,7 +262,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
APPEND_ENTITY_PROPERTY(PROP_VISIBLE, getVisible()); APPEND_ENTITY_PROPERTY(PROP_VISIBLE, getVisible());
APPEND_ENTITY_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, getIgnoreForCollisions()); APPEND_ENTITY_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, getIgnoreForCollisions());
APPEND_ENTITY_PROPERTY(PROP_COLLISION_MASK, getCollisionMask()); APPEND_ENTITY_PROPERTY(PROP_COLLISION_MASK, getCollisionMask());
APPEND_ENTITY_PROPERTY(PROP_COLLISIONS_WILL_MOVE, getCollisionsWillMove()); APPEND_ENTITY_PROPERTY(PROP_DYNAMIC, getDynamic());
APPEND_ENTITY_PROPERTY(PROP_LOCKED, getLocked()); APPEND_ENTITY_PROPERTY(PROP_LOCKED, getLocked());
APPEND_ENTITY_PROPERTY(PROP_USER_DATA, getUserData()); APPEND_ENTITY_PROPERTY(PROP_USER_DATA, getUserData());
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, getMarketplaceID()); APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, getMarketplaceID());
@ -682,7 +682,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
READ_ENTITY_PROPERTY(PROP_VISIBLE, bool, setVisible); READ_ENTITY_PROPERTY(PROP_VISIBLE, bool, setVisible);
READ_ENTITY_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, bool, updateIgnoreForCollisions); READ_ENTITY_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, bool, updateIgnoreForCollisions);
READ_ENTITY_PROPERTY(PROP_COLLISION_MASK, uint8_t, updateCollisionMask); READ_ENTITY_PROPERTY(PROP_COLLISION_MASK, uint8_t, updateCollisionMask);
READ_ENTITY_PROPERTY(PROP_COLLISIONS_WILL_MOVE, bool, updateCollisionsWillMove); READ_ENTITY_PROPERTY(PROP_DYNAMIC, bool, updateDynamic);
READ_ENTITY_PROPERTY(PROP_LOCKED, bool, setLocked); READ_ENTITY_PROPERTY(PROP_LOCKED, bool, setLocked);
READ_ENTITY_PROPERTY(PROP_USER_DATA, QString, setUserData); READ_ENTITY_PROPERTY(PROP_USER_DATA, QString, setUserData);
@ -1046,7 +1046,7 @@ EntityItemProperties EntityItem::getProperties(EntityPropertyFlags desiredProper
COPY_ENTITY_PROPERTY_TO_PROPERTIES(visible, getVisible); COPY_ENTITY_PROPERTY_TO_PROPERTIES(visible, getVisible);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(ignoreForCollisions, getIgnoreForCollisions); COPY_ENTITY_PROPERTY_TO_PROPERTIES(ignoreForCollisions, getIgnoreForCollisions);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(collisionMask, getCollisionMask); COPY_ENTITY_PROPERTY_TO_PROPERTIES(collisionMask, getCollisionMask);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(collisionsWillMove, getCollisionsWillMove); COPY_ENTITY_PROPERTY_TO_PROPERTIES(dynamic, getDynamic);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(locked, getLocked); COPY_ENTITY_PROPERTY_TO_PROPERTIES(locked, getLocked);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(userData, getUserData); COPY_ENTITY_PROPERTY_TO_PROPERTIES(userData, getUserData);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(marketplaceID, getMarketplaceID); COPY_ENTITY_PROPERTY_TO_PROPERTIES(marketplaceID, getMarketplaceID);
@ -1102,7 +1102,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(friction, updateFriction); SET_ENTITY_PROPERTY_FROM_PROPERTIES(friction, updateFriction);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(ignoreForCollisions, updateIgnoreForCollisions); SET_ENTITY_PROPERTY_FROM_PROPERTIES(ignoreForCollisions, updateIgnoreForCollisions);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(collisionMask, updateCollisionMask); SET_ENTITY_PROPERTY_FROM_PROPERTIES(collisionMask, updateCollisionMask);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(collisionsWillMove, updateCollisionsWillMove); SET_ENTITY_PROPERTY_FROM_PROPERTIES(dynamic, updateDynamic);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, updateCreated); SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, updateCreated);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifetime, updateLifetime); SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifetime, updateLifetime);
@ -1458,9 +1458,9 @@ void EntityItem::updateCollisionMask(uint8_t value) {
} }
} }
void EntityItem::updateCollisionsWillMove(bool value) { void EntityItem::updateDynamic(bool value) {
if (_collisionsWillMove != value) { if (_dynamic != value) {
_collisionsWillMove = value; _dynamic = value;
_dirtyFlags |= Simulation::DIRTY_MOTION_TYPE; _dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;
} }
} }

View file

@ -278,8 +278,8 @@ public:
uint8_t getFinalCollisionMask() const { return _ignoreForCollisions ? 0 : _collisionMask; } uint8_t getFinalCollisionMask() const { return _ignoreForCollisions ? 0 : _collisionMask; }
void setCollisionMask(uint8_t value) { _collisionMask = value; } void setCollisionMask(uint8_t value) { _collisionMask = value; }
bool getCollisionsWillMove() const { return _collisionsWillMove; } bool getDynamic() const { return _dynamic; }
void setCollisionsWillMove(bool value) { _collisionsWillMove = value; } void setDynamic(bool value) { _dynamic = value; }
virtual bool shouldBePhysical() const { return false; } virtual bool shouldBePhysical() const { return false; }
@ -333,7 +333,7 @@ public:
void updateAngularDamping(float value); void updateAngularDamping(float value);
void updateIgnoreForCollisions(bool value); void updateIgnoreForCollisions(bool value);
void updateCollisionMask(uint8_t value); void updateCollisionMask(uint8_t value);
void updateCollisionsWillMove(bool value); void updateDynamic(bool value);
void updateLifetime(float value); void updateLifetime(float value);
void updateCreated(uint64_t value); void updateCreated(uint64_t value);
virtual void updateShapeType(ShapeType type) { /* do nothing */ } virtual void updateShapeType(ShapeType type) { /* do nothing */ }
@ -447,8 +447,7 @@ protected:
bool _visible; bool _visible;
bool _ignoreForCollisions; bool _ignoreForCollisions;
uint8_t _collisionMask { ENTITY_COLLISION_MASK_DEFAULT }; uint8_t _collisionMask { ENTITY_COLLISION_MASK_DEFAULT };
uint8_t _collisionGroupOverride; bool _dynamic;
bool _collisionsWillMove;
bool _locked; bool _locked;
QString _userData; QString _userData;
SimulationOwner _simulationOwner; SimulationOwner _simulationOwner;

View file

@ -257,7 +257,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
CHECK_PROPERTY_CHANGE(PROP_ANGULAR_DAMPING, angularDamping); CHECK_PROPERTY_CHANGE(PROP_ANGULAR_DAMPING, angularDamping);
CHECK_PROPERTY_CHANGE(PROP_IGNORE_FOR_COLLISIONS, ignoreForCollisions); CHECK_PROPERTY_CHANGE(PROP_IGNORE_FOR_COLLISIONS, ignoreForCollisions);
CHECK_PROPERTY_CHANGE(PROP_COLLISION_MASK, collisionMask); CHECK_PROPERTY_CHANGE(PROP_COLLISION_MASK, collisionMask);
CHECK_PROPERTY_CHANGE(PROP_COLLISIONS_WILL_MOVE, collisionsWillMove); CHECK_PROPERTY_CHANGE(PROP_DYNAMIC, dynamic);
CHECK_PROPERTY_CHANGE(PROP_IS_SPOTLIGHT, isSpotlight); CHECK_PROPERTY_CHANGE(PROP_IS_SPOTLIGHT, isSpotlight);
CHECK_PROPERTY_CHANGE(PROP_INTENSITY, intensity); CHECK_PROPERTY_CHANGE(PROP_INTENSITY, intensity);
CHECK_PROPERTY_CHANGE(PROP_EXPONENT, exponent); CHECK_PROPERTY_CHANGE(PROP_EXPONENT, exponent);
@ -372,7 +372,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_VISIBLE, visible);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IGNORE_FOR_COLLISIONS, ignoreForCollisions); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IGNORE_FOR_COLLISIONS, ignoreForCollisions);
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISION_MASK, collisionMask, getCollisionMaskAsString()); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_COLLISION_MASK, collisionMask, getCollisionMaskAsString());
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_COLLISIONS_WILL_MOVE, collisionsWillMove); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DYNAMIC, dynamic);
COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_DYNAMIC, dynamic, collisionsWillMove, getDynamic()); // legacy support
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_HREF, href); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_HREF, href);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DESCRIPTION, description); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DESCRIPTION, description);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FACE_CAMERA, faceCamera); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_FACE_CAMERA, faceCamera);
@ -594,7 +595,8 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(localRenderAlpha, float, setLocalRenderAlpha); COPY_PROPERTY_FROM_QSCRIPTVALUE(localRenderAlpha, float, setLocalRenderAlpha);
COPY_PROPERTY_FROM_QSCRIPTVALUE(ignoreForCollisions, bool, setIgnoreForCollisions); COPY_PROPERTY_FROM_QSCRIPTVALUE(ignoreForCollisions, bool, setIgnoreForCollisions);
COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(collisionMask, CollisionMask); COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(collisionMask, CollisionMask);
COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionsWillMove, bool, setCollisionsWillMove); COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(collisionsWillMove, bool, setDynamic, getDynamic); // legacy support
COPY_PROPERTY_FROM_QSCRIPTVALUE(dynamic, bool, setDynamic);
COPY_PROPERTY_FROM_QSCRIPTVALUE(isSpotlight, bool, setIsSpotlight); COPY_PROPERTY_FROM_QSCRIPTVALUE(isSpotlight, bool, setIsSpotlight);
COPY_PROPERTY_FROM_QSCRIPTVALUE(intensity, float, setIntensity); COPY_PROPERTY_FROM_QSCRIPTVALUE(intensity, float, setIntensity);
COPY_PROPERTY_FROM_QSCRIPTVALUE(exponent, float, setExponent); COPY_PROPERTY_FROM_QSCRIPTVALUE(exponent, float, setExponent);
@ -757,7 +759,8 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
ADD_PROPERTY_TO_MAP(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float); ADD_PROPERTY_TO_MAP(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float);
ADD_PROPERTY_TO_MAP(PROP_IGNORE_FOR_COLLISIONS, IgnoreForCollisions, ignoreForCollisions, bool); ADD_PROPERTY_TO_MAP(PROP_IGNORE_FOR_COLLISIONS, IgnoreForCollisions, ignoreForCollisions, bool);
ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, CollisionMask, collisionMask, uint8_t); ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, CollisionMask, collisionMask, uint8_t);
ADD_PROPERTY_TO_MAP(PROP_COLLISIONS_WILL_MOVE, CollisionsWillMove, collisionsWillMove, bool); ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, collisionsWillMove, unused); // legacy support
ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, dynamic, unused);
ADD_PROPERTY_TO_MAP(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool); ADD_PROPERTY_TO_MAP(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool);
ADD_PROPERTY_TO_MAP(PROP_INTENSITY, Intensity, intensity, float); ADD_PROPERTY_TO_MAP(PROP_INTENSITY, Intensity, intensity, float);
ADD_PROPERTY_TO_MAP(PROP_EXPONENT, Exponent, exponent, float); ADD_PROPERTY_TO_MAP(PROP_EXPONENT, Exponent, exponent, float);
@ -1004,7 +1007,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
APPEND_ENTITY_PROPERTY(PROP_VISIBLE, properties.getVisible()); APPEND_ENTITY_PROPERTY(PROP_VISIBLE, properties.getVisible());
APPEND_ENTITY_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, properties.getIgnoreForCollisions()); APPEND_ENTITY_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, properties.getIgnoreForCollisions());
APPEND_ENTITY_PROPERTY(PROP_COLLISION_MASK, properties.getCollisionMask()); APPEND_ENTITY_PROPERTY(PROP_COLLISION_MASK, properties.getCollisionMask());
APPEND_ENTITY_PROPERTY(PROP_COLLISIONS_WILL_MOVE, properties.getCollisionsWillMove()); APPEND_ENTITY_PROPERTY(PROP_DYNAMIC, properties.getDynamic());
APPEND_ENTITY_PROPERTY(PROP_LOCKED, properties.getLocked()); APPEND_ENTITY_PROPERTY(PROP_LOCKED, properties.getLocked());
APPEND_ENTITY_PROPERTY(PROP_USER_DATA, properties.getUserData()); APPEND_ENTITY_PROPERTY(PROP_USER_DATA, properties.getUserData());
APPEND_ENTITY_PROPERTY(PROP_HREF, properties.getHref()); APPEND_ENTITY_PROPERTY(PROP_HREF, properties.getHref());
@ -1297,7 +1300,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE, bool, setVisible); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE, bool, setVisible);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IGNORE_FOR_COLLISIONS, bool, setIgnoreForCollisions); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IGNORE_FOR_COLLISIONS, bool, setIgnoreForCollisions);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISION_MASK, uint8_t, setCollisionMask); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISION_MASK, uint8_t, setCollisionMask);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COLLISIONS_WILL_MOVE, bool, setCollisionsWillMove); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DYNAMIC, bool, setDynamic);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCKED, bool, setLocked); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCKED, bool, setLocked);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_USER_DATA, QString, setUserData); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_USER_DATA, QString, setUserData);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HREF, QString, setHref); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HREF, QString, setHref);
@ -1479,7 +1482,7 @@ void EntityItemProperties::markAllChanged() {
_isSpotlightChanged = true; _isSpotlightChanged = true;
_ignoreForCollisionsChanged = true; _ignoreForCollisionsChanged = true;
_collisionMaskChanged = true; _collisionMaskChanged = true;
_collisionsWillMoveChanged = true; _dynamicChanged = true;
_intensityChanged = true; _intensityChanged = true;
_exponentChanged = true; _exponentChanged = true;
@ -1597,7 +1600,7 @@ bool EntityItemProperties::hasTerseUpdateChanges() const {
bool EntityItemProperties::hasMiscPhysicsChanges() const { bool EntityItemProperties::hasMiscPhysicsChanges() const {
return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged
|| _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged || || _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged ||
_compoundShapeURLChanged || _collisionsWillMoveChanged || _ignoreForCollisionsChanged || _collisionMaskChanged; _compoundShapeURLChanged || _dynamicChanged || _ignoreForCollisionsChanged || _collisionMaskChanged;
} }
void EntityItemProperties::clearSimulationOwner() { void EntityItemProperties::clearSimulationOwner() {
@ -1716,8 +1719,8 @@ QList<QString> EntityItemProperties::listChangedProperties() {
if (collisionMaskChanged()) { if (collisionMaskChanged()) {
out += "collisionMask"; out += "collisionMask";
} }
if (collisionsWillMoveChanged()) { if (dynamicChanged()) {
out += "collisionsWillMove"; out += "dynamic";
} }
if (isSpotlightChanged()) { if (isSpotlightChanged()) {
out += "isSpotlight"; out += "isSpotlight";

View file

@ -129,7 +129,7 @@ public:
DEFINE_PROPERTY(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float, ENTITY_ITEM_DEFAULT_ANGULAR_DAMPING); DEFINE_PROPERTY(PROP_ANGULAR_DAMPING, AngularDamping, angularDamping, float, ENTITY_ITEM_DEFAULT_ANGULAR_DAMPING);
DEFINE_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, IgnoreForCollisions, ignoreForCollisions, bool, ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS); DEFINE_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, IgnoreForCollisions, ignoreForCollisions, bool, ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS);
DEFINE_PROPERTY(PROP_COLLISION_MASK, CollisionMask, collisionMask, uint8_t, ENTITY_COLLISION_MASK_DEFAULT); DEFINE_PROPERTY(PROP_COLLISION_MASK, CollisionMask, collisionMask, uint8_t, ENTITY_COLLISION_MASK_DEFAULT);
DEFINE_PROPERTY(PROP_COLLISIONS_WILL_MOVE, CollisionsWillMove, collisionsWillMove, bool, ENTITY_ITEM_DEFAULT_COLLISIONS_WILL_MOVE); DEFINE_PROPERTY(PROP_DYNAMIC, Dynamic, dynamic, bool, ENTITY_ITEM_DEFAULT_DYNAMIC);
DEFINE_PROPERTY(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool, false); DEFINE_PROPERTY(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool, false);
DEFINE_PROPERTY(PROP_INTENSITY, Intensity, intensity, float, 1.0f); DEFINE_PROPERTY(PROP_INTENSITY, Intensity, intensity, float, 1.0f);
DEFINE_PROPERTY(PROP_EXPONENT, Exponent, exponent, float, 0.0f); DEFINE_PROPERTY(PROP_EXPONENT, Exponent, exponent, float, 0.0f);
@ -356,7 +356,7 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AngularVelocity, angularVelocity, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, AngularVelocity, angularVelocity, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AngularDamping, angularDamping, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, AngularDamping, angularDamping, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, IgnoreForCollisions, ignoreForCollisions, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, IgnoreForCollisions, ignoreForCollisions, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, CollisionsWillMove, collisionsWillMove, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Dynamic, dynamic, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, IsSpotlight, isSpotlight, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, IsSpotlight, isSpotlight, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Intensity, intensity, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Intensity, intensity, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Exponent, exponent, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Exponent, exponent, "");

View file

@ -69,7 +69,7 @@ const float ENTITY_ITEM_MAX_FRICTION = 0.99f;
const float ENTITY_ITEM_DEFAULT_FRICTION = 0.5f; const float ENTITY_ITEM_DEFAULT_FRICTION = 0.5f;
const bool ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS = false; const bool ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS = false;
const bool ENTITY_ITEM_DEFAULT_COLLISIONS_WILL_MOVE = false; const bool ENTITY_ITEM_DEFAULT_DYNAMIC = false;
const bool ENTITY_ITEM_DEFAULT_BILLBOARDED = false; const bool ENTITY_ITEM_DEFAULT_BILLBOARDED = false;
const float ENTITY_ITEM_DEFAULT_CUTOFF = PI / 2; const float ENTITY_ITEM_DEFAULT_CUTOFF = PI / 2;

View file

@ -168,7 +168,15 @@ inline QScriptValue convertScriptValue(QScriptEngine* e, const AACube& v) { retu
QScriptValue V = convertScriptValue(engine, G); \ QScriptValue V = convertScriptValue(engine, G); \
properties.setProperty(#P, V); \ properties.setProperty(#P, V); \
} }
// same as COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER but uses #X instead of #P in the setProperty() step
#define COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(p, P, X, G) \
if ((_desiredProperties.isEmpty() || _desiredProperties.getHasProperty(p)) && \
(!skipDefaults || defaultEntityProperties._##P != _##P)) { \
QScriptValue V = convertScriptValue(engine, G); \
properties.setProperty(#X, V); \
}
#define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(P, G) \ #define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(P, G) \
if (!skipDefaults || defaultEntityProperties._##P != _##P) { \ if (!skipDefaults || defaultEntityProperties._##P != _##P) { \
QScriptValue V = convertScriptValue(engine, G); \ QScriptValue V = convertScriptValue(engine, G); \

View file

@ -17,7 +17,7 @@
enum EntityPropertyList { enum EntityPropertyList {
PROP_PAGED_PROPERTY, PROP_PAGED_PROPERTY,
PROP_CUSTOM_PROPERTIES_INCLUDED, PROP_CUSTOM_PROPERTIES_INCLUDED,
// these properties are supported by the EntityItem base class // these properties are supported by the EntityItem base class
PROP_VISIBLE, PROP_VISIBLE,
PROP_POSITION, PROP_POSITION,
@ -33,7 +33,7 @@ enum EntityPropertyList {
// these properties are supported by some derived classes // these properties are supported by some derived classes
PROP_COLOR, PROP_COLOR,
// these are used by models only // these are used by models only
PROP_MODEL_URL, PROP_MODEL_URL,
PROP_ANIMATION_URL, PROP_ANIMATION_URL,
@ -46,7 +46,7 @@ enum EntityPropertyList {
PROP_ANGULAR_VELOCITY, PROP_ANGULAR_VELOCITY,
PROP_ANGULAR_DAMPING, PROP_ANGULAR_DAMPING,
PROP_IGNORE_FOR_COLLISIONS, PROP_IGNORE_FOR_COLLISIONS,
PROP_COLLISIONS_WILL_MOVE, PROP_DYNAMIC,
// property used by Light entity // property used by Light entity
PROP_IS_SPOTLIGHT, PROP_IS_SPOTLIGHT,

View file

@ -734,15 +734,15 @@ void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<Q
} }
} }
if (properties.collisionsWillMoveChanged()) { if (properties.dynamicChanged()) {
int index = changedProperties.indexOf("collisionsWillMove"); int index = changedProperties.indexOf("dynamic");
if (index >= 0) { if (index >= 0) {
bool value = properties.getCollisionsWillMove(); bool value = properties.getDynamic();
QString changeHint = "0"; QString changeHint = "0";
if (value) { if (value) {
changeHint = "1"; changeHint = "1";
} }
changedProperties[index] = QString("collisionsWillMove:") + changeHint; changedProperties[index] = QString("dynamic:") + changeHint;
} }
} }

View file

@ -139,12 +139,12 @@ bool EntityMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine*
return ObjectMotionState::handleHardAndEasyChanges(flags, engine); return ObjectMotionState::handleHardAndEasyChanges(flags, engine);
} }
MotionType EntityMotionState::computeObjectMotionType() const { PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
if (!_entity) { if (!_entity) {
return MOTION_TYPE_STATIC; return MOTION_TYPE_STATIC;
} }
assert(entityTreeIsLocked()); assert(entityTreeIsLocked());
if (_entity->getCollisionsWillMove()) { if (_entity->getDynamic()) {
return MOTION_TYPE_DYNAMIC; return MOTION_TYPE_DYNAMIC;
} }
return (_entity->isMoving() || _entity->hasActions()) ? MOTION_TYPE_KINEMATIC : MOTION_TYPE_STATIC; return (_entity->isMoving() || _entity->hasActions()) ? MOTION_TYPE_KINEMATIC : MOTION_TYPE_STATIC;
@ -157,7 +157,7 @@ bool EntityMotionState::isMoving() const {
// This callback is invoked by the physics simulation in two cases: // This callback is invoked by the physics simulation in two cases:
// (1) when the RigidBody is first added to the world // (1) when the RigidBody is first added to the world
// (irregardless of MotionType: STATIC, DYNAMIC, or KINEMATIC) // (irregardless of PhysicsMotionType: STATIC, DYNAMIC, or KINEMATIC)
// (2) at the beginning of each simulation step for KINEMATIC RigidBody's -- // (2) at the beginning of each simulation step for KINEMATIC RigidBody's --
// it is an opportunity for outside code to update the object's simulation position // it is an opportunity for outside code to update the object's simulation position
void EntityMotionState::getWorldTransform(btTransform& worldTrans) const { void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
@ -608,7 +608,7 @@ glm::vec3 EntityMotionState::getObjectLinearVelocityChange() const {
} }
// virtual // virtual
void EntityMotionState::setMotionType(MotionType motionType) { void EntityMotionState::setMotionType(PhysicsMotionType motionType) {
ObjectMotionState::setMotionType(motionType); ObjectMotionState::setMotionType(motionType);
resetMeasuredBodyAcceleration(); resetMeasuredBodyAcceleration();
} }
@ -627,7 +627,7 @@ void EntityMotionState::computeCollisionGroupAndMask(int16_t& group, int16_t& ma
if (_entity->getIgnoreForCollisions()) { if (_entity->getIgnoreForCollisions()) {
group = BULLET_COLLISION_GROUP_COLLISIONLESS; group = BULLET_COLLISION_GROUP_COLLISIONLESS;
} }
switch (computeObjectMotionType()){ switch (computePhysicsMotionType()){
case MOTION_TYPE_STATIC: case MOTION_TYPE_STATIC:
group = BULLET_COLLISION_GROUP_STATIC; group = BULLET_COLLISION_GROUP_STATIC;
break; break;

View file

@ -32,8 +32,8 @@ public:
virtual bool handleEasyChanges(uint32_t& flags); virtual bool handleEasyChanges(uint32_t& flags);
virtual bool handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine); virtual bool handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine);
/// \return MOTION_TYPE_DYNAMIC or MOTION_TYPE_STATIC based on params set in EntityItem /// \return PhysicsMotionType based on params set in EntityItem
virtual MotionType computeObjectMotionType() const; virtual PhysicsMotionType computePhysicsMotionType() const;
virtual bool isMoving() const; virtual bool isMoving() const;
@ -94,7 +94,7 @@ protected:
virtual bool isReadyToComputeShape() const override; virtual bool isReadyToComputeShape() const override;
virtual btCollisionShape* computeNewShape(); virtual btCollisionShape* computeNewShape();
virtual void setMotionType(MotionType motionType); virtual void setMotionType(PhysicsMotionType motionType);
// In the glorious future (when entities lib depends on physics lib) the EntityMotionState will be // In the glorious future (when entities lib depends on physics lib) the EntityMotionState will be
// properly "owned" by the EntityItem and will be deleted by it in the dtor. In pursuit of that // properly "owned" by the EntityItem and will be deleted by it in the dtor. In pursuit of that

View file

@ -120,7 +120,7 @@ void ObjectMotionState::releaseShape() {
} }
} }
void ObjectMotionState::setMotionType(MotionType motionType) { void ObjectMotionState::setMotionType(PhysicsMotionType motionType) {
_motionType = motionType; _motionType = motionType;
} }

View file

@ -23,13 +23,13 @@
#include "ContactInfo.h" #include "ContactInfo.h"
#include "ShapeManager.h" #include "ShapeManager.h"
enum MotionType { enum PhysicsMotionType {
MOTION_TYPE_STATIC, // no motion MOTION_TYPE_STATIC, // no motion
MOTION_TYPE_DYNAMIC, // motion according to physical laws MOTION_TYPE_DYNAMIC, // motion according to physical laws
MOTION_TYPE_KINEMATIC // keyframed motion MOTION_TYPE_KINEMATIC // keyframed motion
}; };
inline QString motionTypeToString(MotionType motionType) { inline QString motionTypeToString(PhysicsMotionType motionType) {
switch(motionType) { switch(motionType) {
case MOTION_TYPE_STATIC: return QString("static"); case MOTION_TYPE_STATIC: return QString("static");
case MOTION_TYPE_DYNAMIC: return QString("dynamic"); case MOTION_TYPE_DYNAMIC: return QString("dynamic");
@ -88,7 +88,7 @@ public:
virtual void updateBodyMassProperties(); virtual void updateBodyMassProperties();
MotionStateType getType() const { return _type; } MotionStateType getType() const { return _type; }
virtual MotionType getMotionType() const { return _motionType; } virtual PhysicsMotionType getMotionType() const { return _motionType; }
void setMass(float mass) { _mass = fabsf(mass); } void setMass(float mass) { _mass = fabsf(mass); }
float getMass() { return _mass; } float getMass() { return _mass; }
@ -105,7 +105,7 @@ public:
virtual uint32_t getIncomingDirtyFlags() = 0; virtual uint32_t getIncomingDirtyFlags() = 0;
virtual void clearIncomingDirtyFlags() = 0; virtual void clearIncomingDirtyFlags() = 0;
virtual MotionType computeObjectMotionType() const = 0; virtual PhysicsMotionType computePhysicsMotionType() const = 0;
btCollisionShape* getShape() const { return _shape; } btCollisionShape* getShape() const { return _shape; }
btRigidBody* getRigidBody() const { return _body; } btRigidBody* getRigidBody() const { return _body; }
@ -150,13 +150,13 @@ public:
protected: protected:
virtual bool isReadyToComputeShape() const = 0; virtual bool isReadyToComputeShape() const = 0;
virtual btCollisionShape* computeNewShape() = 0; virtual btCollisionShape* computeNewShape() = 0;
void setMotionType(MotionType motionType); void setMotionType(PhysicsMotionType motionType);
void updateCCDConfiguration(); void updateCCDConfiguration();
void setRigidBody(btRigidBody* body); void setRigidBody(btRigidBody* body);
MotionStateType _type = MOTIONSTATE_TYPE_INVALID; // type of MotionState MotionStateType _type = MOTIONSTATE_TYPE_INVALID; // type of MotionState
MotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC PhysicsMotionType _motionType; // type of motion: KINEMATIC, DYNAMIC, or STATIC
btCollisionShape* _shape; btCollisionShape* _shape;
btRigidBody* _body; btRigidBody* _body;

View file

@ -98,7 +98,7 @@ void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) {
float mass = 0.0f; float mass = 0.0f;
// NOTE: the body may or may not already exist, depending on whether this corresponds to a reinsertion, or a new insertion. // NOTE: the body may or may not already exist, depending on whether this corresponds to a reinsertion, or a new insertion.
btRigidBody* body = motionState->getRigidBody(); btRigidBody* body = motionState->getRigidBody();
MotionType motionType = motionState->computeObjectMotionType(); PhysicsMotionType motionType = motionState->computePhysicsMotionType();
motionState->setMotionType(motionType); motionState->setMotionType(motionType);
switch(motionType) { switch(motionType) {
case MOTION_TYPE_KINEMATIC: { case MOTION_TYPE_KINEMATIC: {

View file

@ -81,7 +81,7 @@ var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
y: -9.8, y: -9.8,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: basketballCollisionSoundURL, collisionSoundURL: basketballCollisionSoundURL,
ignoreForCollisions: false, ignoreForCollisions: false,
modelURL: basketballURL, modelURL: basketballURL,

View file

@ -177,7 +177,7 @@
rotation: rotation, rotation: rotation,
position: position, position: position,
shapeType: 'box', shapeType: 'box',
collisionsWillMove: true, dynamic: true,
script: raveStickEntityScriptURL, script: raveStickEntityScriptURL,
dimensions: { dimensions: {
x: 0.06, x: 0.06,
@ -295,7 +295,7 @@
y: -3.0, y: -3.0,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
spatialKey: { spatialKey: {
@ -351,7 +351,7 @@
position: startPosition, position: startPosition,
rotation: BOW_ROTATION, rotation: BOW_ROTATION,
dimensions: BOW_DIMENSIONS, dimensions: BOW_DIMENSIONS,
collisionsWillMove: true, dynamic: true,
gravity: BOW_GRAVITY, gravity: BOW_GRAVITY,
shapeType: 'compound', shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
@ -493,7 +493,7 @@
y: 1.37, y: 1.37,
z: 1.73 z: 1.73
}, },
collisionsWillMove: true, dynamic: true,
ignoreForCollisions: false, ignoreForCollisions: false,
compoundShapeURL: rackCollisionHullURL, compoundShapeURL: rackCollisionHullURL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -541,7 +541,7 @@
y: -9.8, y: -9.8,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav', collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
ignoreForCollisions: false, ignoreForCollisions: false,
modelURL: basketballURL, modelURL: basketballURL,
@ -686,7 +686,7 @@
type: 'Model', type: 'Model',
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType: 'compound',
collisionsWillMove: true, dynamic: true,
dimensions: TARGET_DIMENSIONS, dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
position: position, position: position,
@ -767,7 +767,7 @@
y: 0.30, y: 0.30,
z: 0.08 z: 0.08
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav", collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
gravity: { gravity: {
x: 0, x: 0,
@ -1057,7 +1057,7 @@
z: 0 z: 0
}, },
shapeType: "box", shapeType: "box",
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
resetMe: { resetMe: {
resetMe: true resetMe: true
@ -1101,7 +1101,7 @@
z: 0.2 z: 0.2
}, },
rotation: rotation, rotation: rotation,
collisionsWillMove: true, dynamic: true,
gravity: { gravity: {
x: 0, x: 0,
y: -100, y: -100,
@ -1152,7 +1152,7 @@
y: 0.21, y: 0.21,
z: 0.47 z: 0.47
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: COLLISION_SOUND_URL, collisionSoundURL: COLLISION_SOUND_URL,
userData: JSON.stringify({ userData: JSON.stringify({
resetMe: { resetMe: {
@ -1200,7 +1200,7 @@
z: 0.05 z: 0.05
}, },
//must be enabled to be grabbable in the physics engine //must be enabled to be grabbable in the physics engine
collisionsWillMove: true, dynamic: true,
compoundShapeURL: WAND_COLLISION_SHAPE, compoundShapeURL: WAND_COLLISION_SHAPE,
script: wandScriptURL, script: wandScriptURL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -1231,7 +1231,7 @@
type: "Model", type: "Model",
modelURL: modelURL, modelURL: modelURL,
position: position, position: position,
collisionsWillMove: true, dynamic: true,
shapeType: "sphere", shapeType: "sphere",
name: "basketball", name: "basketball",
dimensions: { dimensions: {
@ -1291,7 +1291,7 @@
y: -0.1, y: -0.1,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
resetMe: { resetMe: {
resetMe: true resetMe: true
@ -1319,7 +1319,7 @@
y: 0.17, y: 0.17,
z: 0.07 z: 0.07
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav", collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
shapeType: 'box', shapeType: 'box',
restitution: 0, restitution: 0,
@ -1358,7 +1358,7 @@
y: 2.18, y: 2.18,
z: 1.07 z: 1.07
}, },
collisionsWillMove: true, dynamic: true,
shapeType: 'box', shapeType: 'box',
gravity: { gravity: {
x: 0, x: 0,
@ -1402,7 +1402,7 @@
y: 1.56, y: 1.56,
z: 1.35 z: 1.35
}, },
collisionsWillMove: true, dynamic: true,
gravity: { gravity: {
x: 0, x: 0,
y: -0.8, y: -0.8,
@ -1484,7 +1484,7 @@
shapeType: 'box', shapeType: 'box',
name: "block", name: "block",
dimensions: blockTypes[i].dimensions, dimensions: blockTypes[i].dimensions,
collisionsWillMove: true, dynamic: true,
collisionSoundURL: collisionSoundURL, collisionSoundURL: collisionSoundURL,
gravity: { gravity: {
x: 0, x: 0,

View file

@ -157,7 +157,7 @@ MasterReset = function() {
rotation: rotation, rotation: rotation,
position: position, position: position,
shapeType: 'box', shapeType: 'box',
collisionsWillMove: true, dynamic: true,
script: raveStickEntityScriptURL, script: raveStickEntityScriptURL,
dimensions: { dimensions: {
x: 0.06, x: 0.06,
@ -279,7 +279,7 @@ MasterReset = function() {
z: 0 z: 0
}, },
restitution: 0, restitution: 0,
collisionsWillMove: true, dynamic: true,
collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav", collisionSoundURL: "https://s3.amazonaws.com/hifi-public/sounds/Guns/Gun_Drop_and_Metalli_1.wav",
userData: JSON.stringify({ userData: JSON.stringify({
grabbableKey: { grabbableKey: {
@ -336,7 +336,7 @@ MasterReset = function() {
position: startPosition, position: startPosition,
rotation: BOW_ROTATION, rotation: BOW_ROTATION,
dimensions: BOW_DIMENSIONS, dimensions: BOW_DIMENSIONS,
collisionsWillMove: true, dynamic: true,
gravity: BOW_GRAVITY, gravity: BOW_GRAVITY,
shapeType: 'compound', shapeType: 'compound',
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
@ -477,7 +477,7 @@ MasterReset = function() {
y: 1.37, y: 1.37,
z: 1.73 z: 1.73
}, },
collisionsWillMove: true, dynamic: true,
ignoreForCollisions: false, ignoreForCollisions: false,
compoundShapeURL: rackCollisionHullURL, compoundShapeURL: rackCollisionHullURL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -526,7 +526,7 @@ MasterReset = function() {
y: -9.8, y: -9.8,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav', collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
ignoreForCollisions: false, ignoreForCollisions: false,
modelURL: basketballURL, modelURL: basketballURL,
@ -672,7 +672,7 @@ MasterReset = function() {
type: 'Model', type: 'Model',
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType: 'compound',
collisionsWillMove: true, dynamic: true,
dimensions: TARGET_DIMENSIONS, dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
position: position, position: position,
@ -753,7 +753,7 @@ MasterReset = function() {
y: 0.30, y: 0.30,
z: 0.08 z: 0.08
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav", collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
gravity: { gravity: {
x: 0, x: 0,
@ -1043,7 +1043,7 @@ MasterReset = function() {
z: 0 z: 0
}, },
shapeType: "box", shapeType: "box",
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
resetMe: { resetMe: {
resetMe: true resetMe: true
@ -1087,7 +1087,7 @@ MasterReset = function() {
z: 0.2 z: 0.2
}, },
rotation: rotation, rotation: rotation,
collisionsWillMove: true, dynamic: true,
gravity: { gravity: {
x: 0, x: 0,
y: -100, y: -100,
@ -1138,7 +1138,7 @@ MasterReset = function() {
y: 0.21, y: 0.21,
z: 0.47 z: 0.47
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: COLLISION_SOUND_URL, collisionSoundURL: COLLISION_SOUND_URL,
userData: JSON.stringify({ userData: JSON.stringify({
resetMe: { resetMe: {
@ -1186,7 +1186,7 @@ MasterReset = function() {
z: 0.05 z: 0.05
}, },
//must be enabled to be grabbable in the physics engine //must be enabled to be grabbable in the physics engine
collisionsWillMove: true, dynamic: true,
compoundShapeURL: WAND_COLLISION_SHAPE, compoundShapeURL: WAND_COLLISION_SHAPE,
script: wandScriptURL, script: wandScriptURL,
userData: JSON.stringify({ userData: JSON.stringify({
@ -1217,7 +1217,7 @@ MasterReset = function() {
type: "Model", type: "Model",
modelURL: modelURL, modelURL: modelURL,
position: position, position: position,
collisionsWillMove: true, dynamic: true,
shapeType: "sphere", shapeType: "sphere",
name: "basketball", name: "basketball",
dimensions: { dimensions: {
@ -1277,7 +1277,7 @@ MasterReset = function() {
y: -0.1, y: -0.1,
z: 0 z: 0
}, },
collisionsWillMove: true, dynamic: true,
userData: JSON.stringify({ userData: JSON.stringify({
resetMe: { resetMe: {
resetMe: true resetMe: true
@ -1305,7 +1305,7 @@ MasterReset = function() {
y: 0.17, y: 0.17,
z: 0.07 z: 0.07
}, },
collisionsWillMove: true, dynamic: true,
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav", collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
shapeType: 'box', shapeType: 'box',
gravity: { gravity: {
@ -1344,7 +1344,7 @@ MasterReset = function() {
y: 2.18, y: 2.18,
z: 1.07 z: 1.07
}, },
collisionsWillMove: true, dynamic: true,
shapeType: 'box', shapeType: 'box',
gravity: { gravity: {
x: 0, x: 0,
@ -1388,7 +1388,7 @@ MasterReset = function() {
y: 1.56, y: 1.56,
z: 1.35 z: 1.35
}, },
collisionsWillMove: true, dynamic: true,
gravity: { gravity: {
x: 0, x: 0,
y: -0.8, y: -0.8,
@ -1470,7 +1470,7 @@ MasterReset = function() {
shapeType: 'box', shapeType: 'box',
name: "block", name: "block",
dimensions: blockTypes[i].dimensions, dimensions: blockTypes[i].dimensions,
collisionsWillMove: true, dynamic: true,
collisionSoundURL: collisionSoundURL, collisionSoundURL: collisionSoundURL,
gravity: { gravity: {
x: 0, x: 0,

View file

@ -93,7 +93,7 @@
type: 'Model', type: 'Model',
modelURL: MODEL_URL, modelURL: MODEL_URL,
shapeType: 'compound', shapeType: 'compound',
collisionsWillMove: true, dynamic: true,
dimensions: TARGET_DIMENSIONS, dimensions: TARGET_DIMENSIONS,
compoundShapeURL: COLLISION_HULL_URL, compoundShapeURL: COLLISION_HULL_URL,
position: position, position: position,