mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
started to add grabbable psuedo properties to edit.js
This commit is contained in:
parent
8420e67b54
commit
f1992af38e
3 changed files with 56 additions and 13 deletions
|
@ -213,7 +213,6 @@ function AttachedEntitiesManager() {
|
|||
var props = Entities.getEntityProperties(entityID);
|
||||
if (props.parentID == MyAvatar.sessionUUID) {
|
||||
grabData = getEntityCustomData('grabKey', entityID, {});
|
||||
grabbableData = getEntityCustomData('grabbableKey', entityID, {});
|
||||
var wearableData = getEntityCustomData('wearable', entityID, DEFAULT_WEARABLE_DATA);
|
||||
var currentJointName = MyAvatar.getJointNames()[props.parentJointIndex];
|
||||
wearableData.joints[currentJointName] = [props.localPosition, props.localRotation];
|
||||
|
|
|
@ -1006,7 +1006,7 @@ function MyController(hand) {
|
|||
|
||||
// else this thing isn't physical. grab it by reparenting it (but not if we've already
|
||||
// grabbed it).
|
||||
if (grabbableData.refCount < 1) {
|
||||
if (refCount < 1) {
|
||||
this.setState(this.state == STATE_SEARCHING ? STATE_NEAR_GRABBING : STATE_EQUIP);
|
||||
return;
|
||||
} else {
|
||||
|
@ -1120,7 +1120,6 @@ function MyController(hand) {
|
|||
var controllerRotation = Quat.multiply(MyAvatar.orientation, avatarControllerPose.rotation);
|
||||
|
||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||
|
||||
if (this.state == STATE_CONTINUE_DISTANCE_HOLDING && this.bumperSqueezed() &&
|
||||
this.hasPresetOffsets()) {
|
||||
|
@ -1307,7 +1306,6 @@ function MyController(hand) {
|
|||
|
||||
this.nearGrabbing = function() {
|
||||
var now = Date.now();
|
||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||
|
||||
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
||||
this.setState(STATE_RELEASE);
|
||||
|
@ -1330,10 +1328,9 @@ function MyController(hand) {
|
|||
var handRotation = (this.hand === RIGHT_HAND) ? MyAvatar.getRightPalmRotation() : MyAvatar.getLeftPalmRotation();
|
||||
var handPosition = this.getHandPosition();
|
||||
|
||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||
|
||||
var hasPresetPosition = false;
|
||||
if (this.state != STATE_NEAR_GRABBING && this.hasPresetOffsets()) {
|
||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||
// if an object is "equipped" and has a predefined offset, use it.
|
||||
this.ignoreIK = grabbableData.ignoreIK ? grabbableData.ignoreIK : false;
|
||||
this.offsetPosition = this.getPresetPosition();
|
||||
|
@ -1676,7 +1673,6 @@ function MyController(hand) {
|
|||
};
|
||||
|
||||
this.activateEntity = function(entityID, grabbedProperties, wasLoaded) {
|
||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, entityID, DEFAULT_GRABBABLE_DATA);
|
||||
var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {});
|
||||
var now = Date.now();
|
||||
|
||||
|
|
|
@ -243,6 +243,21 @@
|
|||
|
||||
}
|
||||
|
||||
function createUserDataChanger(groupName, keyName, propertyElement, userData) {
|
||||
return function() {
|
||||
var properties = {};
|
||||
// // this.checked
|
||||
// properties['userData'] = ... JSON.stringify (...)
|
||||
// EventBridge.emitWebEvent(
|
||||
// JSON.stringify({
|
||||
// type: "update",
|
||||
// properties: properties,
|
||||
// })
|
||||
// );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function loaded() {
|
||||
openEventBridge(function() {
|
||||
var allSections = [];
|
||||
|
@ -305,6 +320,11 @@
|
|||
var elCollideMyAvatar = document.getElementById("property-collide-myAvatar");
|
||||
var elCollideOtherAvatar = document.getElementById("property-collide-otherAvatar");
|
||||
var elCollisionSoundURL = document.getElementById("property-collision-sound-url");
|
||||
|
||||
var elGrabbable = document.getElementById("property-grabbable" );
|
||||
var elWantsTrigger = document.getElementById("property-wants-trigger" );
|
||||
var elIgnoreIK = document.getElementById("property-ignore-ik" );
|
||||
|
||||
var elLifetime = document.getElementById("property-lifetime");
|
||||
var elScriptURL = document.getElementById("property-script-url");
|
||||
var elScriptTimestamp = document.getElementById("property-script-timestamp");
|
||||
|
@ -408,7 +428,7 @@
|
|||
var elXTextureURL = document.getElementById("property-x-texture-url");
|
||||
var elYTextureURL = document.getElementById("property-y-texture-url");
|
||||
var elZTextureURL = document.getElementById("property-z-texture-url");
|
||||
|
||||
|
||||
var elPreviewCameraButton = document.getElementById("preview-camera-button");
|
||||
|
||||
if (window.EventBridge !== undefined) {
|
||||
|
@ -518,13 +538,15 @@
|
|||
elCollisionless.checked = properties.collisionless;
|
||||
elDynamic.checked = properties.dynamic;
|
||||
|
||||
|
||||
elCollideStatic.checked = properties.collidesWith.indexOf("static") > -1;
|
||||
elCollideKinematic.checked = properties.collidesWith.indexOf("kinematic") > -1;
|
||||
elCollideDynamic.checked = properties.collidesWith.indexOf("dynamic") > -1;
|
||||
elCollideMyAvatar.checked = properties.collidesWith.indexOf("myAvatar") > -1;
|
||||
elCollideOtherAvatar.checked = properties.collidesWith.indexOf("otherAvatar") > -1;
|
||||
|
||||
elGrabbable.checked = properties.collidesWith.indexOf("grabbable") > -1;
|
||||
elWantsTrigger.checked = properties.collidesWith.indexOf("wantsTrigger") > -1;
|
||||
elIgnoreIK.checked = properties.collidesWith.indexOf("ignoreIK") > -1;
|
||||
|
||||
elCollisionSoundURL.value = properties.collisionSoundURL;
|
||||
elLifetime.value = properties.lifetime;
|
||||
|
@ -737,9 +759,6 @@
|
|||
elCollisionless.addEventListener('change', createEmitCheckedPropertyUpdateFunction('collisionless'));
|
||||
elDynamic.addEventListener('change', createEmitCheckedPropertyUpdateFunction('dynamic'));
|
||||
|
||||
|
||||
|
||||
|
||||
elCollideDynamic.addEventListener('change', function() {
|
||||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideDynamic, 'dynamic');
|
||||
});
|
||||
|
@ -758,6 +777,12 @@
|
|||
updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideOtherAvatar, 'otherAvatar');
|
||||
});
|
||||
|
||||
elGrabbable.addEventListener('change', createUserDataChanger("grabbableKey", "grabbable",
|
||||
elGrabbable, properties.userData));
|
||||
elWantsTrigger.addEventListener('change', createUserDataChanger("grabbableKey", "wantsTrigger",
|
||||
elWantsTrigger, properties.userData));
|
||||
elIgnoreIK.addEventListener('change', createUserDataChanger("grabbableKey", "ignoreIK",
|
||||
elIgnoreIK, properties.userData));
|
||||
|
||||
elCollisionSoundURL.addEventListener('change', createEmitTextPropertyUpdateFunction('collisionSoundURL'));
|
||||
|
||||
|
@ -954,7 +979,7 @@
|
|||
action: "previewCamera"
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
window.onblur = function() {
|
||||
// Fake a change event
|
||||
var ev = document.createEvent("HTMLEvents");
|
||||
|
@ -1476,6 +1501,29 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class = "sub-section-header"> Grabbable: </div>
|
||||
<div class = "sub-props-checkbox-group">
|
||||
<div class="property">
|
||||
<span class="label">grabbable</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-grabbable">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<span class="label">triggerable</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-wants-trigger">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<span class="label">ignore inverse-kinematics</span>
|
||||
<span class="value">
|
||||
<input type='checkbox' id="property-ignore-ik">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue