diff --git a/examples/example/entities/particlesTest.js b/examples/example/entities/particlesTest.js index 5f95c348b2..e7f88ce468 100644 --- a/examples/example/entities/particlesTest.js +++ b/examples/example/entities/particlesTest.js @@ -60,7 +60,7 @@ }); break; case 3: - print("Radius spread"); + print("Radius spread - temporarily not working"); Entities.editEntity(particles, { accelerationSpread: { x: 0.0, y: 0.0, z: 0.0 }, radiusSpread: 0.035 @@ -71,6 +71,7 @@ Entities.editEntity(particles, { radiusSpread: 0.0, radiusStart: 0.0, + particleRadius: 2 * PARTICLE_RADIUS, // Bezier interpolation used means that middle value isn't intersected radiusFinish: 0.0 }); break; @@ -78,12 +79,13 @@ print("Alpha 0.5"); Entities.editEntity(particles, { radiusStart: PARTICLE_RADIUS, + particleRadius: PARTICLE_RADIUS, radiusFinish: PARTICLE_RADIUS, alpha: 0.5 }); break; case 6: - print("Alpha spread"); + print("Alpha spread - temporarily not working"); Entities.editEntity(particles, { alpha: 0.5, alphaSpread: 0.5 @@ -99,7 +101,7 @@ }); break; case 8: - print("Color spread"); + print("Color spread - temporarily not working"); Entities.editEntity(particles, { alpha: 1.0, alphaStart: 1.0, @@ -255,7 +257,6 @@ textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png", color: { red: 255, green: 255, blue: 255 }, lifespan: 5.0, - visible: false, locked: false, isEmitting: false, lifetime: 3600 // 1 hour; just in case diff --git a/interface/resources/meshes/defaultAvatar_full/avatar-animation.json b/interface/resources/meshes/defaultAvatar_full/avatar-animation.json index ae470509be..d63942c510 100644 --- a/interface/resources/meshes/defaultAvatar_full/avatar-animation.json +++ b/interface/resources/meshes/defaultAvatar_full/avatar-animation.json @@ -415,10 +415,25 @@ "states": [ { "id": "idle", - "interpTarget": 15, - "interpDuration": 15, + "interpTarget": 10, + "interpDuration": 10, "transitions": [ - { "var": "isMovingForward", "state": "walkFwd" }, + { "var": "isMovingForward", "state": "idleToWalkFwd" }, + { "var": "isMovingBackward", "state": "walkBwd" }, + { "var": "isMovingRight", "state": "strafeRight" }, + { "var": "isMovingLeft", "state": "strafeLeft" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isAway", "state": "awayIntro" } + ] + }, + { + "id": "idleToWalkFwd", + "interpTarget": 3, + "interpDuration": 3, + "transitions": [ + { "var": "idleToWalkFwdOnDone", "state": "walkFwd" }, + { "var": "isNotMoving", "state": "idle" }, { "var": "isMovingBackward", "state": "walkBwd" }, { "var": "isMovingRight", "state": "strafeRight" }, { "var": "isMovingLeft", "state": "strafeLeft" }, @@ -429,7 +444,7 @@ }, { "id": "walkFwd", - "interpTarget": 6, + "interpTarget": 15, "interpDuration": 6, "transitions": [ { "var": "isNotMoving", "state": "idle" }, @@ -638,6 +653,18 @@ } ] }, + { + "id": "idleToWalkFwd", + "type": "clip", + "data": { + "url": "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims/idle_to_walk.fbx", + "startFrame": 1.0, + "endFrame": 19.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, { "id": "walkBwd", "type": "blendLinearMove", diff --git a/libraries/animation/src/AnimBlendLinearMove.cpp b/libraries/animation/src/AnimBlendLinearMove.cpp index 3be6a0f1b8..609b464512 100644 --- a/libraries/animation/src/AnimBlendLinearMove.cpp +++ b/libraries/animation/src/AnimBlendLinearMove.cpp @@ -122,5 +122,5 @@ void AnimBlendLinearMove::setCurrentFrameInternal(float frame) { auto clipNode = std::dynamic_pointer_cast(_children.front()); assert(clipNode); const float NUM_FRAMES = (clipNode->getEndFrame() - clipNode->getStartFrame()) + 1.0f; - _phase = fmodf(frame, NUM_FRAMES); + _phase = fmodf(frame / NUM_FRAMES, 1.0f); } diff --git a/libraries/animation/src/AnimSkeleton.cpp b/libraries/animation/src/AnimSkeleton.cpp index c9c6e43a02..8e3d716aac 100644 --- a/libraries/animation/src/AnimSkeleton.cpp +++ b/libraries/animation/src/AnimSkeleton.cpp @@ -140,6 +140,7 @@ void AnimSkeleton::buildSkeletonFromJoints(const std::vector& joints) } #ifndef NDEBUG +#define DUMP_FBX_JOINTS void AnimSkeleton::dump() const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { @@ -151,21 +152,22 @@ void AnimSkeleton::dump() const { qCDebug(animation) << " absDefaultPose =" << getAbsoluteDefaultPose(i); qCDebug(animation) << " relDefaultPose =" << getRelativeDefaultPose(i); #ifdef DUMP_FBX_JOINTS - qCDebug(animation) << " isFree =" << _joints[i].isFree; - qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage; - qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex; - qCDebug(animation) << " translation =" << _joints[i].translation; - qCDebug(animation) << " preTransform =" << _joints[i].preTransform; - qCDebug(animation) << " preRotation =" << _joints[i].preRotation; - qCDebug(animation) << " rotation =" << _joints[i].rotation; - qCDebug(animation) << " postRotation =" << _joints[i].postRotation; - qCDebug(animation) << " postTransform =" << _joints[i].postTransform; - qCDebug(animation) << " transform =" << _joints[i].transform; - qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax; - qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation; - qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation; - qCDebug(animation) << " bindTransform" << _joints[i].bindTransform; - qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint; + qCDebug(animation) << " fbxJoint ="; + qCDebug(animation) << " isFree =" << _joints[i].isFree; + qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage; + qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex; + qCDebug(animation) << " translation =" << _joints[i].translation; + qCDebug(animation) << " preTransform =" << _joints[i].preTransform; + qCDebug(animation) << " preRotation =" << _joints[i].preRotation; + qCDebug(animation) << " rotation =" << _joints[i].rotation; + qCDebug(animation) << " postRotation =" << _joints[i].postRotation; + qCDebug(animation) << " postTransform =" << _joints[i].postTransform; + qCDebug(animation) << " transform =" << _joints[i].transform; + qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax; + qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation; + qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation; + qCDebug(animation) << " bindTransform" << _joints[i].bindTransform; + qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint; #endif if (getParentIndex(i) >= 0) { qCDebug(animation) << " parent =" << getJointName(getParentIndex(i)); diff --git a/libraries/entities-renderer/src/textured_particle.slv b/libraries/entities-renderer/src/textured_particle.slv index 1e9275ec72..e1f18c2b5f 100644 --- a/libraries/entities-renderer/src/textured_particle.slv +++ b/libraries/entities-renderer/src/textured_particle.slv @@ -82,7 +82,7 @@ void main(void) { varColor = interpolate3Vec4(particle.color.start, particle.color.middle, particle.color.finish, age); // anchor point in eye space - float radius = bezierInterpolate(particle.radius.start, particle.radius.middle, particle.radius.finish , age); + float radius = bezierInterpolate(particle.radius.start, particle.radius.middle, particle.radius.finish, age); vec4 quadPos = radius * UNIT_QUAD[twoTriID]; vec4 anchorPoint; diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 352ab4d701..a1f16ee251 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -13,6 +13,7 @@ #include #include +#include #include "EntitiesLogging.h" #include "EntityItemProperties.h" @@ -243,13 +244,22 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame, _lastKnownFrameDataRotations.resize(_jointMapping.size()); _lastKnownFrameDataTranslations.resize(_jointMapping.size()); + for (int j = 0; j < _jointMapping.size(); j++) { int index = _jointMapping[j]; - if (index != -1 && index < rotations.size()) { - _lastKnownFrameDataRotations[j] = fbxJoints[index].preRotation * rotations[index]; - } - if (index != -1 && index < translations.size()) { - _lastKnownFrameDataTranslations[j] = translations[index]; + if (index >= 0) { + glm::mat4 translationMat; + if (index < translations.size()) { + translationMat = glm::translate(translations[index]); + } + glm::mat4 rotationMat; + if (index < rotations.size()) { + rotationMat = glm::mat4_cast(rotations[index]); + } + glm::mat4 finalMat = (translationMat * fbxJoints[index].preTransform * + rotationMat * fbxJoints[index].postTransform); + _lastKnownFrameDataTranslations[j] = extractTranslation(finalMat); + _lastKnownFrameDataRotations[j] = glmExtractRotation(finalMat); } } } diff --git a/plugins/hifiSixense/src/SixenseManager.cpp b/plugins/hifiSixense/src/SixenseManager.cpp index fb47697166..b534c09055 100644 --- a/plugins/hifiSixense/src/SixenseManager.cpp +++ b/plugins/hifiSixense/src/SixenseManager.cpp @@ -466,9 +466,10 @@ void SixenseManager::InputDevice::handlePoseEvent(float deltaTime, glm::vec3 pos samples.first.addSample(velocity); velocity = samples.first.average; - auto deltaRot = rotation * glm::conjugate(prevPose.getRotation()); + auto deltaRot = glm::normalize(rotation * glm::conjugate(prevPose.getRotation())); auto axis = glm::axis(deltaRot); auto speed = glm::angle(deltaRot) / deltaTime; + assert(!glm::isnan(speed)); angularVelocity = speed * axis; samples.second.addSample(angularVelocity); angularVelocity = samples.second.average;