mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
commit
5f7442f78d
10 changed files with 172 additions and 29 deletions
|
@ -49,8 +49,8 @@ function actionArgumentsToString(actionArguments) {
|
||||||
|
|
||||||
|
|
||||||
function updateOverlay(entityID, actionText) {
|
function updateOverlay(entityID, actionText) {
|
||||||
var properties = Entities.getEntityProperties(entityID, ["position"]);
|
var properties = Entities.getEntityProperties(entityID, ["position", "dimensions"]);
|
||||||
var position = Vec3.sum(properties.position, {x:0, y:1, z:0});
|
var position = Vec3.sum(properties.position, {x:0, y:properties.dimensions.y, z:0});
|
||||||
// print("position: " + vec3toStr(position) + " " + actionText);
|
// print("position: " + vec3toStr(position) + " " + actionText);
|
||||||
if (entityID in overlays) {
|
if (entityID in overlays) {
|
||||||
var overlay = overlays[entityID];
|
var overlay = overlays[entityID];
|
||||||
|
|
|
@ -91,6 +91,27 @@ var currentAvatarCollisionsMenu = initialAvatarCollisionsMenu;
|
||||||
var noCollisionsCount = 0; // how many hands want collisions disabled?
|
var noCollisionsCount = 0; // how many hands want collisions disabled?
|
||||||
|
|
||||||
|
|
||||||
|
function getTag() {
|
||||||
|
return "grab-" + MyAvatar.sessionUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
function entityIsGrabbedByOther(entityID) {
|
||||||
|
var actionIDs = Entities.getActionIDs(entityID);
|
||||||
|
for (var actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
||||||
|
var actionID = actionIDs[actionIndex];
|
||||||
|
var actionArguments = Entities.getActionArguments(entityID, actionID);
|
||||||
|
var tag = actionArguments["tag"];
|
||||||
|
if (tag == getTag()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (tag.slice(0, 5) == "grab-") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function MyController(hand, triggerAction) {
|
function MyController(hand, triggerAction) {
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
if (this.hand === RIGHT_HAND) {
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
@ -252,7 +273,8 @@ function MyController(hand, triggerAction) {
|
||||||
var intersection = Entities.findRayIntersection(pickRay, true);
|
var intersection = Entities.findRayIntersection(pickRay, true);
|
||||||
if (intersection.intersects &&
|
if (intersection.intersects &&
|
||||||
intersection.properties.collisionsWillMove === 1 &&
|
intersection.properties.collisionsWillMove === 1 &&
|
||||||
intersection.properties.locked === 0) {
|
intersection.properties.locked === 0 &&
|
||||||
|
!entityIsGrabbedByOther(intersection.entityID)) {
|
||||||
// the ray is intersecting something we can move.
|
// the ray is intersecting something we can move.
|
||||||
var handControllerPosition = Controller.getSpatialControlPosition(this.palm);
|
var handControllerPosition = Controller.getSpatialControlPosition(this.palm);
|
||||||
var intersectionDistance = Vec3.distance(handControllerPosition, intersection.intersection);
|
var intersectionDistance = Vec3.distance(handControllerPosition, intersection.intersection);
|
||||||
|
@ -320,11 +342,14 @@ function MyController(hand, triggerAction) {
|
||||||
this.handPreviousPosition = handControllerPosition;
|
this.handPreviousPosition = handControllerPosition;
|
||||||
this.handPreviousRotation = handRotation;
|
this.handPreviousRotation = handRotation;
|
||||||
|
|
||||||
|
this.actionID = NULL_ACTION_ID;
|
||||||
this.actionID = Entities.addAction("spring", this.grabbedEntity, {
|
this.actionID = Entities.addAction("spring", this.grabbedEntity, {
|
||||||
targetPosition: this.currentObjectPosition,
|
targetPosition: this.currentObjectPosition,
|
||||||
linearTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
linearTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||||
targetRotation: this.currentObjectRotation,
|
targetRotation: this.currentObjectRotation,
|
||||||
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME
|
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||||
|
tag: getTag(),
|
||||||
|
lifetime: 5
|
||||||
});
|
});
|
||||||
if (this.actionID === NULL_ACTION_ID) {
|
if (this.actionID === NULL_ACTION_ID) {
|
||||||
this.actionID = null;
|
this.actionID = null;
|
||||||
|
@ -424,7 +449,8 @@ function MyController(hand, triggerAction) {
|
||||||
targetPosition: this.currentObjectPosition,
|
targetPosition: this.currentObjectPosition,
|
||||||
linearTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
linearTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||||
targetRotation: this.currentObjectRotation,
|
targetRotation: this.currentObjectRotation,
|
||||||
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME
|
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||||
|
lifetime: 5
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -457,12 +483,17 @@ function MyController(hand, triggerAction) {
|
||||||
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
||||||
var offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, offsetRotation)), offset);
|
var offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, offsetRotation)), offset);
|
||||||
|
|
||||||
|
this.actionID = NULL_ACTION_ID;
|
||||||
|
if (!entityIsGrabbedByOther(this.grabbedEntity)) {
|
||||||
this.actionID = Entities.addAction("hold", this.grabbedEntity, {
|
this.actionID = Entities.addAction("hold", this.grabbedEntity, {
|
||||||
hand: this.hand === RIGHT_HAND ? "right" : "left",
|
hand: this.hand === RIGHT_HAND ? "right" : "left",
|
||||||
timeScale: NEAR_GRABBING_ACTION_TIMEFRAME,
|
timeScale: NEAR_GRABBING_ACTION_TIMEFRAME,
|
||||||
relativePosition: offsetPosition,
|
relativePosition: offsetPosition,
|
||||||
relativeRotation: offsetRotation
|
relativeRotation: offsetRotation,
|
||||||
|
tag: getTag(),
|
||||||
|
lifetime: 5
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if (this.actionID === NULL_ACTION_ID) {
|
if (this.actionID === NULL_ACTION_ID) {
|
||||||
this.actionID = null;
|
this.actionID = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -507,6 +538,8 @@ function MyController(hand, triggerAction) {
|
||||||
this.currentHandControllerTipPosition = handControllerPosition;
|
this.currentHandControllerTipPosition = handControllerPosition;
|
||||||
this.currentObjectTime = now;
|
this.currentObjectTime = now;
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrab");
|
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrab");
|
||||||
|
|
||||||
|
Entities.updateAction(this.grabbedEntity, this.actionID, {lifetime: 5});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.nearGrabbingNonColliding = function() {
|
this.nearGrabbingNonColliding = function() {
|
||||||
|
|
|
@ -14,6 +14,25 @@ var MAX_SOLID_ANGLE = 0.01; // objects that appear smaller than this can't be gr
|
||||||
var ZERO_VEC3 = {x: 0, y: 0, z: 0};
|
var ZERO_VEC3 = {x: 0, y: 0, z: 0};
|
||||||
var IDENTITY_QUAT = {x: 0, y: 0, z: 0, w: 0};
|
var IDENTITY_QUAT = {x: 0, y: 0, z: 0, w: 0};
|
||||||
|
|
||||||
|
function getTag() {
|
||||||
|
return "grab-" + MyAvatar.sessionUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
function entityIsGrabbedByOther(entityID) {
|
||||||
|
var actionIDs = Entities.getActionIDs(entityID);
|
||||||
|
for (var actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
||||||
|
var actionID = actionIDs[actionIndex];
|
||||||
|
var actionArguments = Entities.getActionArguments(entityID, actionID);
|
||||||
|
var tag = actionArguments["tag"];
|
||||||
|
if (tag == getTag()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (tag.slice(0, 5) == "grab-") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// helper function
|
// helper function
|
||||||
function mouseIntersectionWithPlane(pointOnPlane, planeNormal, event, maxDistance) {
|
function mouseIntersectionWithPlane(pointOnPlane, planeNormal, event, maxDistance) {
|
||||||
|
@ -288,7 +307,7 @@ Grabber.prototype.moveEvent = function(event) {
|
||||||
}
|
}
|
||||||
this.currentPosition = entityProperties.position;
|
this.currentPosition = entityProperties.position;
|
||||||
|
|
||||||
var actionArgs = {};
|
var actionArgs = {tag: getTag(), lifetime: 5};
|
||||||
|
|
||||||
if (this.mode === "rotate") {
|
if (this.mode === "rotate") {
|
||||||
var drag = mouse.getDrag();
|
var drag = mouse.getDrag();
|
||||||
|
@ -303,7 +322,7 @@ Grabber.prototype.moveEvent = function(event) {
|
||||||
// var qZero = entityProperties.rotation;
|
// var qZero = entityProperties.rotation;
|
||||||
//var qZero = this.lastRotation;
|
//var qZero = this.lastRotation;
|
||||||
this.lastRotation = Quat.multiply(deltaQ, this.lastRotation);
|
this.lastRotation = Quat.multiply(deltaQ, this.lastRotation);
|
||||||
actionArgs = {targetRotation: this.lastRotation, angularTimeScale: 0.1};
|
actionArgs = {targetRotation: this.lastRotation, angularTimeScale: 0.1, tag: getTag(), lifetime: 5};
|
||||||
} else {
|
} else {
|
||||||
var newPointOnPlane;
|
var newPointOnPlane;
|
||||||
if (this.mode === "verticalCylinder") {
|
if (this.mode === "verticalCylinder") {
|
||||||
|
@ -327,13 +346,15 @@ Grabber.prototype.moveEvent = function(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.targetPosition = Vec3.subtract(newPointOnPlane, this.offset);
|
this.targetPosition = Vec3.subtract(newPointOnPlane, this.offset);
|
||||||
actionArgs = {targetPosition: this.targetPosition, linearTimeScale: 0.1};
|
actionArgs = {targetPosition: this.targetPosition, linearTimeScale: 0.1, tag: getTag(), lifetime: 5};
|
||||||
|
|
||||||
beacon.updatePosition(this.targetPosition);
|
beacon.updatePosition(this.targetPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.actionID) {
|
if (!this.actionID) {
|
||||||
|
if (!entityIsGrabbedByOther(this.entityID)) {
|
||||||
this.actionID = Entities.addAction("spring", this.entityID, actionArgs);
|
this.actionID = Entities.addAction("spring", this.entityID, actionArgs);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Entities.updateAction(this.entityID, this.actionID, actionArgs);
|
Entities.updateAction(this.entityID, this.actionID, actionArgs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,9 @@ EntityActionPointer InterfaceActionFactory::factory(EntityActionType type,
|
||||||
if (action) {
|
if (action) {
|
||||||
bool ok = action->updateArguments(arguments);
|
bool ok = action->updateArguments(arguments);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
if (action->lifetimeIsOver()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,5 +66,9 @@ EntityActionPointer InterfaceActionFactory::factoryBA(EntityItemPointer ownerEnt
|
||||||
if (action) {
|
if (action) {
|
||||||
action->deserialize(data);
|
action->deserialize(data);
|
||||||
}
|
}
|
||||||
|
if (action->lifetimeIsOver()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,9 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
|
||||||
|
|
||||||
|
|
||||||
bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
||||||
|
if (!ObjectAction::updateArguments(arguments)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
glm::vec3 relativePosition =
|
glm::vec3 relativePosition =
|
||||||
EntityActionInterface::extractVec3Argument("hold", arguments, "relativePosition", ok, false);
|
EntityActionInterface::extractVec3Argument("hold", arguments, "relativePosition", ok, false);
|
||||||
|
@ -134,7 +137,7 @@ bool AvatarActionHold::updateArguments(QVariantMap arguments) {
|
||||||
|
|
||||||
|
|
||||||
QVariantMap AvatarActionHold::getArguments() {
|
QVariantMap AvatarActionHold::getArguments() {
|
||||||
QVariantMap arguments;
|
QVariantMap arguments = ObjectAction::getArguments();
|
||||||
withReadLock([&]{
|
withReadLock([&]{
|
||||||
if (!_mine) {
|
if (!_mine) {
|
||||||
arguments = ObjectActionSpring::getArguments();
|
arguments = ObjectActionSpring::getArguments();
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
static EntityActionType actionTypeFromString(QString actionTypeString);
|
static EntityActionType actionTypeFromString(QString actionTypeString);
|
||||||
static QString actionTypeToString(EntityActionType actionType);
|
static QString actionTypeToString(EntityActionType actionType);
|
||||||
|
|
||||||
|
virtual bool lifetimeIsOver() { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual glm::vec3 getPosition() = 0;
|
virtual glm::vec3 getPosition() = 0;
|
||||||
virtual void setPosition(glm::vec3 position) = 0;
|
virtual void setPosition(glm::vec3 position) = 0;
|
||||||
|
|
|
@ -30,6 +30,18 @@ void ObjectAction::updateAction(btCollisionWorld* collisionWorld, btScalar delta
|
||||||
dynamicsWorld->removeAction(this);
|
dynamicsWorld->removeAction(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_expires > 0) {
|
||||||
|
quint64 now = usecTimestampNow();
|
||||||
|
if (now > _expires) {
|
||||||
|
EntityItemPointer ownerEntity = _ownerEntity.lock();
|
||||||
|
_active = false;
|
||||||
|
if (ownerEntity) {
|
||||||
|
ownerEntity->removeAction(nullptr, getID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!_active) {
|
if (!_active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +49,40 @@ void ObjectAction::updateAction(btCollisionWorld* collisionWorld, btScalar delta
|
||||||
updateActionWorker(deltaTimeStep);
|
updateActionWorker(deltaTimeStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObjectAction::updateArguments(QVariantMap arguments) {
|
||||||
|
bool lifetimeSet = true;
|
||||||
|
float lifetime = EntityActionInterface::extractFloatArgument("action", arguments, "lifetime", lifetimeSet, false);
|
||||||
|
if (lifetimeSet) {
|
||||||
|
quint64 now = usecTimestampNow();
|
||||||
|
_expires = now + (quint64)(lifetime * USECS_PER_SECOND);
|
||||||
|
} else {
|
||||||
|
_expires = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tagSet = true;
|
||||||
|
QString tag = EntityActionInterface::extractStringArgument("action", arguments, "tag", tagSet, false);
|
||||||
|
if (tagSet) {
|
||||||
|
_tag = tag;
|
||||||
|
} else {
|
||||||
|
tag = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap ObjectAction::getArguments() {
|
||||||
|
QVariantMap arguments;
|
||||||
|
if (_expires == 0) {
|
||||||
|
arguments["lifetime"] = 0.0f;
|
||||||
|
} else {
|
||||||
|
quint64 now = usecTimestampNow();
|
||||||
|
arguments["lifetime"] = (float)(_expires - now) / (float)USECS_PER_SECOND;
|
||||||
|
}
|
||||||
|
arguments["tag"] = _tag;
|
||||||
|
return arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ObjectAction::debugDraw(btIDebugDraw* debugDrawer) {
|
void ObjectAction::debugDraw(btIDebugDraw* debugDrawer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,3 +182,14 @@ void ObjectAction::activateBody() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObjectAction::lifetimeIsOver() {
|
||||||
|
if (_expires == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 now = usecTimestampNow();
|
||||||
|
if (now >= _expires) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ public:
|
||||||
virtual EntityItemWeakPointer getOwnerEntity() const { return _ownerEntity; }
|
virtual EntityItemWeakPointer getOwnerEntity() const { return _ownerEntity; }
|
||||||
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) { _ownerEntity = ownerEntity; }
|
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) { _ownerEntity = ownerEntity; }
|
||||||
|
|
||||||
virtual bool updateArguments(QVariantMap arguments) = 0;
|
virtual bool updateArguments(QVariantMap arguments);
|
||||||
virtual QVariantMap getArguments() = 0;
|
virtual QVariantMap getArguments();
|
||||||
|
|
||||||
// this is called from updateAction and should be overridden by subclasses
|
// this is called from updateAction and should be overridden by subclasses
|
||||||
virtual void updateActionWorker(float deltaTimeStep) = 0;
|
virtual void updateActionWorker(float deltaTimeStep) = 0;
|
||||||
|
@ -46,6 +46,8 @@ public:
|
||||||
virtual QByteArray serialize() const = 0;
|
virtual QByteArray serialize() const = 0;
|
||||||
virtual void deserialize(QByteArray serializedArguments) = 0;
|
virtual void deserialize(QByteArray serializedArguments) = 0;
|
||||||
|
|
||||||
|
virtual bool lifetimeIsOver();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual btRigidBody* getRigidBody();
|
virtual btRigidBody* getRigidBody();
|
||||||
|
@ -59,11 +61,11 @@ protected:
|
||||||
virtual void setAngularVelocity(glm::vec3 angularVelocity);
|
virtual void setAngularVelocity(glm::vec3 angularVelocity);
|
||||||
virtual void activateBody();
|
virtual void activateBody();
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool _active;
|
bool _active;
|
||||||
EntityItemWeakPointer _ownerEntity;
|
EntityItemWeakPointer _ownerEntity;
|
||||||
|
|
||||||
|
quint64 _expires; // in seconds since epoch
|
||||||
|
QString _tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ObjectAction_h
|
#endif // hifi_ObjectAction_h
|
||||||
|
|
|
@ -80,6 +80,9 @@ void ObjectActionOffset::updateActionWorker(btScalar deltaTimeStep) {
|
||||||
|
|
||||||
|
|
||||||
bool ObjectActionOffset::updateArguments(QVariantMap arguments) {
|
bool ObjectActionOffset::updateArguments(QVariantMap arguments) {
|
||||||
|
if (!ObjectAction::updateArguments(arguments)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
glm::vec3 pointToOffsetFrom =
|
glm::vec3 pointToOffsetFrom =
|
||||||
EntityActionInterface::extractVec3Argument("offset action", arguments, "pointToOffsetFrom", ok, true);
|
EntityActionInterface::extractVec3Argument("offset action", arguments, "pointToOffsetFrom", ok, true);
|
||||||
|
@ -119,7 +122,7 @@ bool ObjectActionOffset::updateArguments(QVariantMap arguments) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap ObjectActionOffset::getArguments() {
|
QVariantMap ObjectActionOffset::getArguments() {
|
||||||
QVariantMap arguments;
|
QVariantMap arguments = ObjectAction::getArguments();
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
arguments["pointToOffsetFrom"] = glmToQMap(_pointToOffsetFrom);
|
arguments["pointToOffsetFrom"] = glmToQMap(_pointToOffsetFrom);
|
||||||
arguments["linearTimeScale"] = _linearTimeScale;
|
arguments["linearTimeScale"] = _linearTimeScale;
|
||||||
|
@ -140,6 +143,9 @@ QByteArray ObjectActionOffset::serialize() const {
|
||||||
dataStream << _linearTimeScale;
|
dataStream << _linearTimeScale;
|
||||||
dataStream << _positionalTargetSet;
|
dataStream << _positionalTargetSet;
|
||||||
|
|
||||||
|
dataStream << _expires;
|
||||||
|
dataStream << _tag;
|
||||||
|
|
||||||
return ba;
|
return ba;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,5 +171,8 @@ void ObjectActionOffset::deserialize(QByteArray serializedArguments) {
|
||||||
dataStream >> _linearTimeScale;
|
dataStream >> _linearTimeScale;
|
||||||
dataStream >> _positionalTargetSet;
|
dataStream >> _positionalTargetSet;
|
||||||
|
|
||||||
|
dataStream >> _expires;
|
||||||
|
dataStream >> _tag;
|
||||||
|
|
||||||
_active = true;
|
_active = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,9 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) {
|
||||||
const float MIN_TIMESCALE = 0.1f;
|
const float MIN_TIMESCALE = 0.1f;
|
||||||
|
|
||||||
bool ObjectActionSpring::updateArguments(QVariantMap arguments) {
|
bool ObjectActionSpring::updateArguments(QVariantMap arguments) {
|
||||||
|
if (!ObjectAction::updateArguments(arguments)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// targets are required, spring-constants are optional
|
// targets are required, spring-constants are optional
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
glm::vec3 positionalTarget =
|
glm::vec3 positionalTarget =
|
||||||
|
@ -155,7 +158,7 @@ bool ObjectActionSpring::updateArguments(QVariantMap arguments) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap ObjectActionSpring::getArguments() {
|
QVariantMap ObjectActionSpring::getArguments() {
|
||||||
QVariantMap arguments;
|
QVariantMap arguments = ObjectAction::getArguments();
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
arguments["linearTimeScale"] = _linearTimeScale;
|
arguments["linearTimeScale"] = _linearTimeScale;
|
||||||
arguments["targetPosition"] = glmToQMap(_positionalTarget);
|
arguments["targetPosition"] = glmToQMap(_positionalTarget);
|
||||||
|
@ -182,6 +185,9 @@ QByteArray ObjectActionSpring::serialize() const {
|
||||||
dataStream << _angularTimeScale;
|
dataStream << _angularTimeScale;
|
||||||
dataStream << _rotationalTargetSet;
|
dataStream << _rotationalTargetSet;
|
||||||
|
|
||||||
|
dataStream << _expires;
|
||||||
|
dataStream << _tag;
|
||||||
|
|
||||||
return serializedActionArguments;
|
return serializedActionArguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,5 +216,8 @@ void ObjectActionSpring::deserialize(QByteArray serializedArguments) {
|
||||||
dataStream >> _angularTimeScale;
|
dataStream >> _angularTimeScale;
|
||||||
dataStream >> _rotationalTargetSet;
|
dataStream >> _rotationalTargetSet;
|
||||||
|
|
||||||
|
dataStream >> _expires;
|
||||||
|
dataStream >> _tag;
|
||||||
|
|
||||||
_active = true;
|
_active = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue