For development testing, apply physics to the entity intersected

This commit is contained in:
David Rowe 2017-08-12 16:59:28 +12:00
parent a5407398e7
commit bc00bcd02c
2 changed files with 16 additions and 1 deletions

View file

@ -415,6 +415,15 @@ Selection = function (side) {
}
function applyPhysics(physicsProperties) {
// TODO: For development testing, apply physics to the currently intersected entity.
var properties;
properties = Object.clone(physicsProperties);
properties.userData = updatePhysicsUserData(selection[intersectedEntityIndex].userData, physicsProperties.userData);
Entities.editEntity(selection[intersectedEntityIndex].id, properties);
// TODO: Original functionality applied physics to all entities in the selection.
/*
// Applies physics to the current selection (i.e., the selection made when entity was trigger-clicked to apply physics).
var properties,
i,
@ -434,6 +443,7 @@ Selection = function (side) {
Entities.editEntity(selection[0].id, { velocity: DYNAMIC_VELOCITY_KICK });
}
}
*/
}
function clear() {

View file

@ -851,7 +851,6 @@
function update() {
var previousState = editorState,
doUpdateState,
doRefreshSelection,
color;
intersection = getIntersection();
@ -953,6 +952,12 @@
intersectedEntityID = intersection.entityID;
doUpdateState = true;
}
// TODO: For development testing, update intersectedEntityID so that physics can be applied to it.
if ((toolSelected === TOOL_COLOR || toolSelected === TOOL_PHYSICS)
&& intersection.entityID !== intersectedEntityID) {
intersectedEntityID = intersection.entityID;
doUpdateState = true;
}
if (doUpdateState) {
updateState();
}