mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:36:45 +02:00
added the arm ik files to the repo, this is for the shoulder and elbow extensions
This commit is contained in:
parent
af38a40b85
commit
3e553f015c
2 changed files with 74 additions and 0 deletions
40
libraries/animation/src/AnimArmIK.cpp
Normal file
40
libraries/animation/src/AnimArmIK.cpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
//
|
||||||
|
// AnimArmIK.cpp
|
||||||
|
//
|
||||||
|
// Created by Angus Antley on 1/9/19.
|
||||||
|
// Copyright (c) 2019 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "AnimArmIK.h"
|
||||||
|
|
||||||
|
#include <DebugDraw.h>
|
||||||
|
|
||||||
|
#include "AnimationLogging.h"
|
||||||
|
#include "AnimUtil.h"
|
||||||
|
|
||||||
|
AnimArmIK::AnimArmIK(const QString& id, float alpha, bool enabled, float interpDuration,
|
||||||
|
const QString& baseJointName, const QString& midJointName,
|
||||||
|
const QString& tipJointName, const glm::vec3& midHingeAxis,
|
||||||
|
const QString& alphaVar, const QString& enabledVar,
|
||||||
|
const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar) :
|
||||||
|
AnimTwoBoneIK(id, alpha, enabled, interpDuration, baseJointName, midJointName, tipJointName, midHingeAxis, alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimArmIK::~AnimArmIK() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const AnimPoseVec& AnimArmIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) {
|
||||||
|
qCDebug(animation) << "evaluating the arm IK";
|
||||||
|
|
||||||
|
assert(_children.size() == 1);
|
||||||
|
if (_children.size() != 1) {
|
||||||
|
return _poses;
|
||||||
|
} else {
|
||||||
|
return _poses;
|
||||||
|
}
|
||||||
|
}
|
34
libraries/animation/src/AnimArmIK.h
Normal file
34
libraries/animation/src/AnimArmIK.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// AnimArmIK.h
|
||||||
|
//
|
||||||
|
// Created by Angus Antley on 1/9/19.
|
||||||
|
// Copyright (c) 2019 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_AnimArmIK_h
|
||||||
|
#define hifi_AnimArmIK_h
|
||||||
|
|
||||||
|
//#include "AnimNode.h"
|
||||||
|
#include "AnimTwoBoneIK.h"
|
||||||
|
//#include "AnimChain.h"
|
||||||
|
|
||||||
|
// Simple two bone IK chain
|
||||||
|
class AnimArmIK : public AnimTwoBoneIK {
|
||||||
|
public:
|
||||||
|
AnimArmIK(const QString& id, float alpha, bool enabled, float interpDuration,
|
||||||
|
const QString& baseJointName, const QString& midJointName,
|
||||||
|
const QString& tipJointName, const glm::vec3& midHingeAxis,
|
||||||
|
const QString& alphaVar, const QString& enabledVar,
|
||||||
|
const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar);
|
||||||
|
virtual ~AnimArmIK();
|
||||||
|
virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_AnimArmIK_h
|
||||||
|
|
Loading…
Reference in a new issue