Adding simple CollisionInfo class as data wrapper and a findSphereCollision() method to AgentData API.

This commit is contained in:
Andrew Meadows 2014-01-14 16:11:27 -08:00
parent f28fc5f79b
commit eb207efe32
3 changed files with 50 additions and 2 deletions

View file

@ -303,5 +303,4 @@ void AvatarData::setNewScale(float newScale) {
newScale = MIN_SCALE;
}
_newScale = newScale;
qDebug() << "Changed scale to " << _newScale << "\n";
}

View file

@ -20,9 +20,10 @@
#include <QtCore/QUuid>
#include <QtCore/QVariantMap>
#include <CollisionInfo.h>
#include <RegisteredMetaTypes.h>
#include <NodeData.h>
#include "HeadData.h"
#include "HandData.h"
@ -119,6 +120,10 @@ public:
/// \return whether or not the sphere penetrated
virtual bool findSpherePenetration(const glm::vec3& penetratorCenter, float penetratorRadius,
glm::vec3& penetration, int skeletonSkipIndex = -1) const { return false; }
virtual bool findSphereCollision(const glm::vec3& sphereCenter, float sphereRadius, CollisionInfo& collision) {
return false;
}
protected:
QUuid _uuid;

View file

@ -0,0 +1,44 @@
//
// CollisionInfo.h
// hifi
//
// Created by Andrew Meadows on 2014.01.13
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
#ifndef __hifi__CollisionInfo__
#define __hifi__CollisionInfo__
/*
#include <ostream>
#include <stdint.h>
#ifdef _WIN32
#include "Syssocket.h"
#else
#include <sys/socket.h>
#endif
#include <QtCore/QDebug>
#include <QtCore/QUuid>
#include "HifiSockAddr.h"
#include "NodeData.h"
#include "SimpleMovingAverage.h"
*/
#include <glm/glm.hpp>
class CollisionInfo {
public:
CollisionInfo() : _penetration(0.f), _addedVelocity(0.f) { }
~CollisionInfo() {}
//glm::vec3 _point;
//glm::vec3 _normal;
glm::vec3 _penetration;
glm::vec3 _addedVelocity;
};
#endif /* defined(__hifi__CollisionInfo__) */