mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
set correct type in kinematic hold
This commit is contained in:
parent
89c848d8c8
commit
6a770a870b
1 changed files with 4 additions and 10 deletions
|
@ -26,7 +26,7 @@ AvatarActionKinematicHold::AvatarActionKinematicHold(const QUuid& id, EntityItem
|
||||||
_previousPositionalTarget(Vectors::ZERO),
|
_previousPositionalTarget(Vectors::ZERO),
|
||||||
_previousRotationalTarget(Quaternions::IDENTITY)
|
_previousRotationalTarget(Quaternions::IDENTITY)
|
||||||
{
|
{
|
||||||
_type = ACTION_TYPE_HOLD;
|
_type = ACTION_TYPE_KINEMATIC_HOLD;
|
||||||
#if WANT_DEBUG
|
#if WANT_DEBUG
|
||||||
qDebug() << "AvatarActionKinematicHold::AvatarActionKinematicHold";
|
qDebug() << "AvatarActionKinematicHold::AvatarActionKinematicHold";
|
||||||
#endif
|
#endif
|
||||||
|
@ -95,12 +95,6 @@ void AvatarActionKinematicHold::updateActionWorker(float deltaTimeStep) {
|
||||||
if (_previousSet) {
|
if (_previousSet) {
|
||||||
glm::vec3 positionalVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep;
|
glm::vec3 positionalVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep;
|
||||||
rigidBody->setLinearVelocity(glmToBullet(positionalVelocity));
|
rigidBody->setLinearVelocity(glmToBullet(positionalVelocity));
|
||||||
|
|
||||||
glm::quat rotationalDelta = glm::inverse(_previousRotationalTarget) * _rotationalTarget;
|
|
||||||
glm::vec3 rotationalDeltaAxis = glm::axis(rotationalDelta);
|
|
||||||
float rotationalDeltaAngle = glm::angle(rotationalDelta);
|
|
||||||
glm::vec3 rotationalVelocity = glm::normalize(rotationalDeltaAxis) * rotationalDeltaAngle / deltaTimeStep;
|
|
||||||
rigidBody->setAngularVelocity(glmToBullet(rotationalVelocity));
|
|
||||||
}
|
}
|
||||||
_previousPositionalTarget = _positionalTarget;
|
_previousPositionalTarget = _positionalTarget;
|
||||||
_previousRotationalTarget = _rotationalTarget;
|
_previousRotationalTarget = _rotationalTarget;
|
||||||
|
@ -123,21 +117,21 @@ bool AvatarActionKinematicHold::updateArguments(QVariantMap arguments) {
|
||||||
}
|
}
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
glm::vec3 relativePosition =
|
glm::vec3 relativePosition =
|
||||||
EntityActionInterface::extractVec3Argument("hold", arguments, "relativePosition", ok, false);
|
EntityActionInterface::extractVec3Argument("kinematic-hold", arguments, "relativePosition", ok, false);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
relativePosition = _relativePosition;
|
relativePosition = _relativePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
glm::quat relativeRotation =
|
glm::quat relativeRotation =
|
||||||
EntityActionInterface::extractQuatArgument("hold", arguments, "relativeRotation", ok, false);
|
EntityActionInterface::extractQuatArgument("kinematic-hold", arguments, "relativeRotation", ok, false);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
relativeRotation = _relativeRotation;
|
relativeRotation = _relativeRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
QString hand =
|
QString hand =
|
||||||
EntityActionInterface::extractStringArgument("hold", arguments, "hand", ok, false);
|
EntityActionInterface::extractStringArgument("kinematic-hold", arguments, "hand", ok, false);
|
||||||
if (!ok || !(hand == "left" || hand == "right")) {
|
if (!ok || !(hand == "left" || hand == "right")) {
|
||||||
hand = _hand;
|
hand = _hand;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue