give other avatars an anim-skeleton

This commit is contained in:
Seth Alves 2015-10-15 14:21:06 -07:00
parent a70ba4cd5a
commit 4903db45b1
5 changed files with 19 additions and 7 deletions

View file

@ -70,6 +70,9 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
gotLock = withTryWriteLock([&]{
_positionalTarget = position;
_rotationalTarget = rotation;
_positionalTargetSet = true;
_rotationalTargetSet = true;
_active = true;
});
}
if (gotLock) {

View file

@ -229,6 +229,12 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
Model::simulate(deltaTime, fullUpdate);
// let rig compute the model offset
glm::vec3 modelOffset;
if (_rig->getModelOffset(modelOffset)) {
setOffset(modelOffset);
}
if (!isActive() || !_owningAvatar->isMyAvatar()) {
return; // only simulate for own avatar
}
@ -246,12 +252,6 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
Hand* hand = _owningAvatar->getHand();
hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
// let rig compute the model offset
glm::vec3 modelOffset;
if (_rig->getModelOffset(modelOffset)) {
setOffset(modelOffset);
}
// Don't Relax toward hand positions when in animGraph mode.
if (!_rig->getEnableAnimGraph()) {
const float HAND_RESTORATION_RATE = 0.25f;

View file

@ -1245,12 +1245,18 @@ void Rig::updateFromHandParameters(const HandParameters& params, float dt) {
}
}
void Rig::makeAnimSkeleton(const FBXGeometry& fbxGeometry) {
if (!_animSkeleton) {
_animSkeleton = std::make_shared<AnimSkeleton>(fbxGeometry);
}
}
void Rig::initAnimGraph(const QUrl& url, const FBXGeometry& fbxGeometry) {
if (!_enableAnimGraph) {
return;
}
_animSkeleton = std::make_shared<AnimSkeleton>(fbxGeometry);
makeAnimSkeleton(fbxGeometry);
// load the anim graph
_animLoader.reset(new AnimNodeLoader(url));

View file

@ -193,6 +193,7 @@ public:
virtual void setHandPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation,
float scale, float priority) = 0;
void makeAnimSkeleton(const FBXGeometry& fbxGeometry);
void initAnimGraph(const QUrl& url, const FBXGeometry& fbxGeometry);
AnimNode::ConstPointer getAnimNode() const { return _animNode; }

View file

@ -1147,6 +1147,8 @@ void Model::segregateMeshGroups() {
const FBXGeometry& geometry = _geometry->getFBXGeometry();
const std::vector<std::unique_ptr<NetworkMesh>>& networkMeshes = _geometry->getMeshes();
_rig->makeAnimSkeleton(geometry);
// all of our mesh vectors must match in size
if ((int)networkMeshes.size() != geometry.meshes.size() ||
geometry.meshes.size() != _meshStates.size()) {