Merge pull request #6927 from AndrewMeadows/zero-velocities

entity.js will zero velocities when entities cease to be dynamic
This commit is contained in:
Brad Hefta-Gaub 2016-01-25 16:00:54 -08:00
commit 7d8a3de711

View file

@ -1556,6 +1556,11 @@ PropertiesTool = function(opts) {
Entities.editEntity(selectionManager.selections[i], properties);
}
} else {
if (data.properties.dynamic === false) {
// this object is leaving dynamic, so we zero its velocities
data.properties["velocity"] = {x: 0, y: 0, z: 0};
data.properties["angularVelocity"] = {x: 0, y: 0, z: 0};
}
if (data.properties.rotation !== undefined) {
var rotation = data.properties.rotation;
data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z);
@ -1836,4 +1841,4 @@ propertyMenu.onSelectMenuItem = function(name) {
var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
propertiesTool = PropertiesTool();
propertiesTool = PropertiesTool();