mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 11:54:20 +02:00
Add rotation to properties window
This commit is contained in:
parent
b8737ad525
commit
d1f5bf2e3c
2 changed files with 28 additions and 0 deletions
|
@ -1004,6 +1004,7 @@ PropertiesTool = function(opts) {
|
|||
};
|
||||
if (selectionManager.hasSelection()) {
|
||||
data.properties = Entities.getEntityProperties(selectionManager.selections[0]);
|
||||
data.properties.rotation = Quat.safeEulerAngles(data.properties.rotation);
|
||||
}
|
||||
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
||||
});
|
||||
|
@ -1012,6 +1013,10 @@ PropertiesTool = function(opts) {
|
|||
print(data);
|
||||
data = JSON.parse(data);
|
||||
if (data.type == "update") {
|
||||
if (data.properties.rotation !== undefined) {
|
||||
var rotation = data.properties.rotation;
|
||||
data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z);
|
||||
}
|
||||
Entities.editEntity(selectionManager.selections[0], data.properties);
|
||||
selectionManager._update();
|
||||
}
|
||||
|
|
|
@ -85,6 +85,10 @@
|
|||
var elRegistrationY = document.getElementById("property-reg-y");
|
||||
var elRegistrationZ = document.getElementById("property-reg-z");
|
||||
|
||||
var elRotationX = document.getElementById("property-rot-x");
|
||||
var elRotationY = document.getElementById("property-rot-y");
|
||||
var elRotationZ = document.getElementById("property-rot-z");
|
||||
|
||||
var elLinearVelocityX = document.getElementById("property-lvel-x");
|
||||
var elLinearVelocityY = document.getElementById("property-lvel-y");
|
||||
var elLinearVelocityZ = document.getElementById("property-lvel-z");
|
||||
|
@ -181,6 +185,10 @@
|
|||
elRegistrationY.value = properties.registrationPoint.y.toFixed(2);
|
||||
elRegistrationZ.value = properties.registrationPoint.z.toFixed(2);
|
||||
|
||||
elRotationX.value = properties.rotation.x.toFixed(2);
|
||||
elRotationY.value = properties.rotation.y.toFixed(2);
|
||||
elRotationZ.value = properties.rotation.z.toFixed(2);
|
||||
|
||||
elLinearVelocityX.value = properties.velocity.x.toFixed(2);
|
||||
elLinearVelocityY.value = properties.velocity.y.toFixed(2);
|
||||
elLinearVelocityZ.value = properties.velocity.z.toFixed(2);
|
||||
|
@ -302,6 +310,12 @@
|
|||
elRegistrationY.addEventListener('change', registrationChangeFunction);
|
||||
elRegistrationZ.addEventListener('change', registrationChangeFunction);
|
||||
|
||||
var rotationChangeFunction = createEmitVec3PropertyUpdateFunction(
|
||||
'rotation', elRotationX, elRotationY, elRotationZ);
|
||||
elRotationX.addEventListener('change', rotationChangeFunction);
|
||||
elRotationY.addEventListener('change', rotationChangeFunction);
|
||||
elRotationZ.addEventListener('change', rotationChangeFunction);
|
||||
|
||||
var velocityChangeFunction = createEmitVec3PropertyUpdateFunction(
|
||||
'velocity', elLinearVelocityX, elLinearVelocityY, elLinearVelocityZ);
|
||||
elLinearVelocityX.addEventListener('change', velocityChangeFunction);
|
||||
|
@ -486,6 +500,15 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label">Rotation</td>
|
||||
<td>
|
||||
<div class="input-area">Pitch <input class="coord" type='number' id="property-rot-x"></input></div>
|
||||
<div class="input-area">Yaw <input class="coord" type='number' id="property-rot-y"></input></div>
|
||||
<div class="input-area">Roll <input class="coord" type='number' id="property-rot-z"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label">Linear Velocity</td>
|
||||
<td>
|
||||
|
|
Loading…
Reference in a new issue