mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 09:33:36 +02:00
helper methods to rotate/translate CollisionInfo
This commit is contained in:
parent
8ede0ed32b
commit
ef6d2a624b
2 changed files with 19 additions and 0 deletions
|
@ -8,6 +8,18 @@
|
|||
|
||||
#include "CollisionInfo.h"
|
||||
|
||||
void CollisionInfo::rotateThenTranslate(const glm::quat& rotation, const glm::vec3& translation) {
|
||||
_contactPoint = translation + rotation * _contactPoint;
|
||||
_penetration = rotation * _penetration;
|
||||
_addedVelocity = rotation * _addedVelocity;
|
||||
}
|
||||
|
||||
void CollisionInfo::translateThenRotate(const glm::vec3& translation, const glm::quat& rotation) {
|
||||
_contactPoint = rotation * (_contactPoint + translation);
|
||||
_penetration = rotation * _penetration;
|
||||
_addedVelocity = rotation * _addedVelocity;
|
||||
}
|
||||
|
||||
CollisionList::CollisionList(int maxSize) :
|
||||
_maxSize(maxSize),
|
||||
_size(0) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define __hifi__CollisionInfo__
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include <QVector>
|
||||
|
||||
|
@ -55,6 +56,12 @@ public:
|
|||
|
||||
~CollisionInfo() {}
|
||||
|
||||
/// Rotate and translate the details.
|
||||
void rotateThenTranslate(const glm::quat& rotation, const glm::vec3& translation);
|
||||
|
||||
/// Translate then rotate the details
|
||||
void translateThenRotate(const glm::vec3& translation, const glm::quat& rotation);
|
||||
|
||||
qint32 _type; // type of Collision (will determine what is supposed to be in _data and _flags)
|
||||
void* _data; // pointer to user supplied data
|
||||
quint32 _flags; // 32 bits for whatever
|
||||
|
|
Loading…
Reference in a new issue