mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 13:33:38 +02:00
pull out motor action, fix import of slider and cone-twist constraints
This commit is contained in:
parent
fabcd7e8e0
commit
bc6fb182eb
7 changed files with 28 additions and 37 deletions
|
@ -21,7 +21,6 @@
|
|||
#include <ObjectConstraintSlider.h>
|
||||
#include <ObjectConstraintBallSocket.h>
|
||||
#include <ObjectConstraintConeTwist.h>
|
||||
#include <ObjectActionMotor.h>
|
||||
#include <LogHandler.h>
|
||||
|
||||
#include "InterfaceDynamicFactory.h"
|
||||
|
@ -51,8 +50,6 @@ EntityDynamicPointer interfaceDynamicFactory(EntityDynamicType type, const QUuid
|
|||
return std::make_shared<ObjectConstraintBallSocket>(id, ownerEntity);
|
||||
case DYNAMIC_TYPE_CONE_TWIST:
|
||||
return std::make_shared<ObjectConstraintConeTwist>(id, ownerEntity);
|
||||
case DYNAMIC_TYPE_MOTOR:
|
||||
return std::make_shared<ObjectActionMotor>(id, ownerEntity);
|
||||
}
|
||||
|
||||
qDebug() << "Unknown entity dynamic type";
|
||||
|
|
|
@ -129,9 +129,6 @@ EntityDynamicType EntityDynamicInterface::dynamicTypeFromString(QString dynamicT
|
|||
if (normalizedDynamicTypeString == "conetwist") {
|
||||
return DYNAMIC_TYPE_CONE_TWIST;
|
||||
}
|
||||
if (normalizedDynamicTypeString == "motor") {
|
||||
return DYNAMIC_TYPE_MOTOR;
|
||||
}
|
||||
|
||||
qCDebug(entities) << "Warning -- EntityDynamicInterface::dynamicTypeFromString got unknown dynamic-type name"
|
||||
<< dynamicTypeString;
|
||||
|
@ -162,8 +159,6 @@ QString EntityDynamicInterface::dynamicTypeToString(EntityDynamicType dynamicTyp
|
|||
return "ball-socket";
|
||||
case DYNAMIC_TYPE_CONE_TWIST:
|
||||
return "cone-twist";
|
||||
case DYNAMIC_TYPE_MOTOR:
|
||||
return "motor";
|
||||
}
|
||||
assert(false);
|
||||
return "none";
|
||||
|
|
|
@ -36,8 +36,7 @@ enum EntityDynamicType {
|
|||
DYNAMIC_TYPE_FAR_GRAB = 6000,
|
||||
DYNAMIC_TYPE_SLIDER = 7000,
|
||||
DYNAMIC_TYPE_BALL_SOCKET = 8000,
|
||||
DYNAMIC_TYPE_CONE_TWIST = 9000,
|
||||
DYNAMIC_TYPE_MOTOR = 10000,
|
||||
DYNAMIC_TYPE_CONE_TWIST = 9000
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
|||
case PacketType::EntityEdit:
|
||||
case PacketType::EntityData:
|
||||
case PacketType::EntityPhysics:
|
||||
return VERSION_ENTITIES_DYNAMICS_MOTOR;
|
||||
return VERSION_ENTITIES_BULLET_DYNAMICS;
|
||||
case PacketType::EntityQuery:
|
||||
return static_cast<PacketVersion>(EntityQueryPacketVersion::JSONFilterWithFamilyTree);
|
||||
case PacketType::AvatarIdentity:
|
||||
|
|
|
@ -209,7 +209,6 @@ const PacketVersion VERSION_ENTITIES_PHYSICS_PACKET = 67;
|
|||
const PacketVersion VERSION_ENTITIES_ZONE_FILTERS = 68;
|
||||
const PacketVersion VERSION_ENTITIES_HINGE_CONSTRAINT = 69;
|
||||
const PacketVersion VERSION_ENTITIES_BULLET_DYNAMICS = 70;
|
||||
const PacketVersion VERSION_ENTITIES_DYNAMICS_MOTOR = 71;
|
||||
|
||||
enum class EntityQueryPacketVersion: PacketVersion {
|
||||
JSONFilter = 18,
|
||||
|
|
|
@ -126,8 +126,8 @@ btTypedConstraint* ObjectConstraintConeTwist::getConstraint() {
|
|||
axisInB = glm::normalize(axisInB);
|
||||
}
|
||||
|
||||
glm::quat rotA = glm::rotation(glm::vec3(1.0f, 0.0f, 0.0f), axisInA);
|
||||
glm::quat rotB = glm::rotation(glm::vec3(1.0f, 0.0f, 0.0f), axisInB);
|
||||
glm::quat rotA = glm::rotation(DEFAULT_CONE_TWIST_AXIS, axisInA);
|
||||
glm::quat rotB = glm::rotation(DEFAULT_CONE_TWIST_AXIS, axisInB);
|
||||
|
||||
btTransform frameInA(glmToBullet(rotA), glmToBullet(pivotInA));
|
||||
btTransform frameInB(glmToBullet(rotB), glmToBullet(pivotInB));
|
||||
|
@ -141,7 +141,7 @@ btTypedConstraint* ObjectConstraintConeTwist::getConstraint() {
|
|||
} else {
|
||||
// This coneTwist is between an entity and the world-frame.
|
||||
|
||||
glm::quat rot = glm::rotation(glm::vec3(1.0f, 0.0f, 0.0f), axisInA);
|
||||
glm::quat rot = glm::rotation(DEFAULT_CONE_TWIST_AXIS, axisInA);
|
||||
|
||||
btTransform frameInA(glmToBullet(rot), glmToBullet(pivotInA));
|
||||
|
||||
|
@ -295,19 +295,17 @@ bool ObjectConstraintConeTwist::updateArguments(QVariantMap arguments) {
|
|||
QVariantMap ObjectConstraintConeTwist::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
if (_constraint) {
|
||||
arguments["pivot"] = glmToQMap(_pivotInA);
|
||||
arguments["axis"] = glmToQMap(_axisInA);
|
||||
arguments["otherEntityID"] = _otherID;
|
||||
arguments["otherPivot"] = glmToQMap(_pivotInB);
|
||||
arguments["otherAxis"] = glmToQMap(_axisInB);
|
||||
arguments["swingSpan1"] = _swingSpan1;
|
||||
arguments["swingSpan2"] = _swingSpan2;
|
||||
arguments["twistSpan"] = _twistSpan;
|
||||
arguments["softness"] = _softness;
|
||||
arguments["biasFactor"] = _biasFactor;
|
||||
arguments["relaxationFactor"] = _relaxationFactor;
|
||||
}
|
||||
arguments["pivot"] = glmToQMap(_pivotInA);
|
||||
arguments["axis"] = glmToQMap(_axisInA);
|
||||
arguments["otherEntityID"] = _otherID;
|
||||
arguments["otherPivot"] = glmToQMap(_pivotInB);
|
||||
arguments["otherAxis"] = glmToQMap(_axisInB);
|
||||
arguments["swingSpan1"] = _swingSpan1;
|
||||
arguments["swingSpan2"] = _swingSpan2;
|
||||
arguments["twistSpan"] = _twistSpan;
|
||||
arguments["softness"] = _softness;
|
||||
arguments["biasFactor"] = _biasFactor;
|
||||
arguments["relaxationFactor"] = _relaxationFactor;
|
||||
});
|
||||
return arguments;
|
||||
}
|
||||
|
|
|
@ -258,18 +258,21 @@ bool ObjectConstraintSlider::updateArguments(QVariantMap arguments) {
|
|||
QVariantMap ObjectConstraintSlider::getArguments() {
|
||||
QVariantMap arguments = ObjectDynamic::getArguments();
|
||||
withReadLock([&] {
|
||||
arguments["point"] = glmToQMap(_pointInA);
|
||||
arguments["axis"] = glmToQMap(_axisInA);
|
||||
arguments["otherEntityID"] = _otherID;
|
||||
arguments["otherPoint"] = glmToQMap(_pointInB);
|
||||
arguments["otherAxis"] = glmToQMap(_axisInB);
|
||||
arguments["linearLow"] = _linearLow;
|
||||
arguments["linearHigh"] = _linearHigh;
|
||||
arguments["angularLow"] = _angularLow;
|
||||
arguments["angularHigh"] = _angularHigh;
|
||||
if (_constraint) {
|
||||
arguments["point"] = glmToQMap(_pointInA);
|
||||
arguments["axis"] = glmToQMap(_axisInA);
|
||||
arguments["otherEntityID"] = _otherID;
|
||||
arguments["otherPoint"] = glmToQMap(_pointInB);
|
||||
arguments["otherAxis"] = glmToQMap(_axisInB);
|
||||
arguments["linearLow"] = _linearLow;
|
||||
arguments["linearHigh"] = _linearHigh;
|
||||
arguments["angularLow"] = _angularLow;
|
||||
arguments["angularHigh"] = _angularHigh;
|
||||
arguments["linearPosition"] = static_cast<btSliderConstraint*>(_constraint)->getLinearPos();
|
||||
arguments["angularPosition"] = static_cast<btSliderConstraint*>(_constraint)->getAngularPos();
|
||||
} else {
|
||||
arguments["linearPosition"] = 0.0f;
|
||||
arguments["angularPosition"] = 0.0f;
|
||||
}
|
||||
});
|
||||
return arguments;
|
||||
|
|
Loading…
Reference in a new issue