mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:57:58 +02:00
Adding simple CollisionInfo class as data wrapper and a findSphereCollision() method to AgentData API.
This commit is contained in:
parent
f28fc5f79b
commit
eb207efe32
3 changed files with 50 additions and 2 deletions
|
@ -303,5 +303,4 @@ void AvatarData::setNewScale(float newScale) {
|
||||||
newScale = MIN_SCALE;
|
newScale = MIN_SCALE;
|
||||||
}
|
}
|
||||||
_newScale = newScale;
|
_newScale = newScale;
|
||||||
qDebug() << "Changed scale to " << _newScale << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,10 @@
|
||||||
#include <QtCore/QUuid>
|
#include <QtCore/QUuid>
|
||||||
#include <QtCore/QVariantMap>
|
#include <QtCore/QVariantMap>
|
||||||
|
|
||||||
|
#include <CollisionInfo.h>
|
||||||
#include <RegisteredMetaTypes.h>
|
#include <RegisteredMetaTypes.h>
|
||||||
|
|
||||||
#include <NodeData.h>
|
#include <NodeData.h>
|
||||||
|
|
||||||
#include "HeadData.h"
|
#include "HeadData.h"
|
||||||
#include "HandData.h"
|
#include "HandData.h"
|
||||||
|
|
||||||
|
@ -119,6 +120,10 @@ public:
|
||||||
/// \return whether or not the sphere penetrated
|
/// \return whether or not the sphere penetrated
|
||||||
virtual bool findSpherePenetration(const glm::vec3& penetratorCenter, float penetratorRadius,
|
virtual bool findSpherePenetration(const glm::vec3& penetratorCenter, float penetratorRadius,
|
||||||
glm::vec3& penetration, int skeletonSkipIndex = -1) const { return false; }
|
glm::vec3& penetration, int skeletonSkipIndex = -1) const { return false; }
|
||||||
|
|
||||||
|
virtual bool findSphereCollision(const glm::vec3& sphereCenter, float sphereRadius, CollisionInfo& collision) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QUuid _uuid;
|
QUuid _uuid;
|
||||||
|
|
44
libraries/shared/src/CollisionInfo.h
Normal file
44
libraries/shared/src/CollisionInfo.h
Normal 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__) */
|
Loading…
Reference in a new issue