mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-07 23:49:57 +02:00
Merge branch 'rig' of github.com:howard-stearns/hifi into rig
This commit is contained in:
commit
75a35f9fcf
6 changed files with 37 additions and 61 deletions
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <GeometryUtil.h>
|
||||
#include <NodeList.h>
|
||||
#include <ProgramObject.h>
|
||||
|
||||
#include "AvatarManager.h"
|
||||
#include "Hand.h"
|
||||
|
@ -43,58 +42,6 @@ void Hand::simulate(float deltaTime, bool isMine) {
|
|||
}
|
||||
}
|
||||
|
||||
// We create a static CollisionList that is recycled for each collision test.
|
||||
const float MAX_COLLISIONS_PER_AVATAR = 32;
|
||||
static CollisionList handCollisions(MAX_COLLISIONS_PER_AVATAR);
|
||||
|
||||
void Hand::collideAgainstAvatar(Avatar* avatar, bool isMyHand) {
|
||||
if (!avatar || avatar == _owningAvatar) {
|
||||
// don't collide hands against ourself (that is done elsewhere)
|
||||
return;
|
||||
}
|
||||
|
||||
const SkeletonModel& skeletonModel = _owningAvatar->getSkeletonModel();
|
||||
int jointIndices[2];
|
||||
jointIndices[0] = skeletonModel.getLeftHandJointIndex();
|
||||
jointIndices[1] = skeletonModel.getRightHandJointIndex();
|
||||
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
int jointIndex = jointIndices[i];
|
||||
if (jointIndex < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
handCollisions.clear();
|
||||
QVector<const Shape*> shapes;
|
||||
skeletonModel.getHandShapes(jointIndex, shapes);
|
||||
|
||||
if (avatar->findCollisions(shapes, handCollisions)) {
|
||||
glm::vec3 totalPenetration(0.0f);
|
||||
glm::vec3 averageContactPoint;
|
||||
for (int j = 0; j < handCollisions.size(); ++j) {
|
||||
CollisionInfo* collision = handCollisions.getCollision(j);
|
||||
totalPenetration += collision->_penetration;
|
||||
averageContactPoint += collision->_contactPoint;
|
||||
}
|
||||
if (isMyHand) {
|
||||
// our hand against other avatar
|
||||
// TODO: resolve this penetration when we don't think the other avatar will yield
|
||||
//palm.addToPenetration(averagePenetration);
|
||||
} else {
|
||||
// someone else's hand against MyAvatar
|
||||
// TODO: submit collision info to MyAvatar which should lean accordingly
|
||||
averageContactPoint /= (float)handCollisions.size();
|
||||
avatar->applyCollision(averageContactPoint, totalPenetration);
|
||||
|
||||
CollisionInfo collision;
|
||||
collision._penetration = totalPenetration;
|
||||
collision._contactPoint = averageContactPoint;
|
||||
emit avatar->collisionWithAvatar(avatar->getSessionUUID(), _owningAvatar->getSessionUUID(), collision);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Hand::resolvePenetrations() {
|
||||
for (size_t i = 0; i < getNumPalms(); ++i) {
|
||||
PalmData& palm = getPalms()[i];
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
|
||||
|
||||
class Avatar;
|
||||
class ProgramObject;
|
||||
|
||||
const float HAND_PADDLE_OFFSET = 0.1f;
|
||||
const float HAND_PADDLE_THICKNESS = 0.01f;
|
||||
const float HAND_PADDLE_RADIUS = 0.15f;
|
||||
|
||||
class Hand : public HandData {
|
||||
public:
|
||||
|
@ -43,8 +38,6 @@ public:
|
|||
void simulate(float deltaTime, bool isMine);
|
||||
void render(RenderArgs* renderArgs, bool isMine);
|
||||
|
||||
void collideAgainstAvatar(Avatar* avatar, bool isMyHand);
|
||||
|
||||
void resolvePenetrations();
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
const float EYE_EAR_GAP = 0.08f;
|
||||
|
||||
class Avatar;
|
||||
class ProgramObject;
|
||||
|
||||
class Head : public HeadData {
|
||||
public:
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <SettingHandle.h>
|
||||
#include <DynamicCharacterController.h>
|
||||
#include <Rig.h>
|
||||
|
||||
#include "Avatar.h"
|
||||
|
||||
|
@ -285,6 +286,7 @@ private:
|
|||
QString _bodyModelName;
|
||||
QString _fullAvatarModelName;
|
||||
|
||||
Rig _rig;
|
||||
// used for rendering when in first person view or when in an HMD.
|
||||
SkeletonModel _firstPersonSkeletonModel;
|
||||
bool _prevShouldDrawHead;
|
||||
|
|
12
libraries/animation/src/Rig.cpp
Normal file
12
libraries/animation/src/Rig.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
//
|
||||
// Rig.cpp
|
||||
// libraries/script-engine/src/
|
||||
//
|
||||
// Created by Howard Stearns, Seth Alves, Anthony Thibault, Andrew Meadows on 7/15/15.
|
||||
// Copyright (c) 2015 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 "Rig.h"
|
23
libraries/animation/src/Rig.h
Normal file
23
libraries/animation/src/Rig.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// Rig.h
|
||||
// libraries/script-engine/src/
|
||||
//
|
||||
// Produces animation data and hip placement for the current timestamp.
|
||||
//
|
||||
// Created by Howard Stearns, Seth Alves, Anthony Thibault, Andrew Meadows on 7/15/15.
|
||||
// Copyright (c) 2015 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__Rig__
|
||||
#define __hifi__Rig__
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Rig : public QObject {
|
||||
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__Rig__) */
|
Loading…
Reference in a new issue