Commit iniziale: è presente una base del progetto con joint di base
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include "../../pieces/headers/piece_interface.hpp"
|
||||
|
||||
#ifndef JOINT_INTERFACE_H
|
||||
#define JOINT_INTERFACE_H
|
||||
|
||||
/*
|
||||
1) il joint può essere tra più pezzi
|
||||
2) esistono 3 tipi di joint:
|
||||
- completi / rigidi
|
||||
- a pivot / 1 grado di libertà di rotazione
|
||||
- spillo / completa libertà di rotazione
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class JointInterface{
|
||||
protected:
|
||||
virtual void rotate(unsigned int id) = 0;
|
||||
virtual void traslate(unsigned int id) = 0;
|
||||
|
||||
public:
|
||||
std::vector<rb::Vector3> offset;
|
||||
std::vector<rb::Vector3_s> rotOffset;
|
||||
PieceInterface* father;
|
||||
std::vector<PieceInterface*> childs;
|
||||
|
||||
virtual ~JointInterface(){};
|
||||
virtual void movechild() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "joint_interface.hpp"
|
||||
|
||||
class PivotJoint : public JointInterface {
|
||||
protected:
|
||||
void rotate(unsigned int id) override;
|
||||
void traslate(unsigned int id) override;
|
||||
|
||||
rb::Vector3_s oldRot;
|
||||
rb::Vector3 pivot;
|
||||
std::vector<rb::Vector3_s> oldCRot;
|
||||
|
||||
//possono servire per calcolare l'offset rispetto alla posizione precedente
|
||||
rb::Vector3 oldPos;
|
||||
std::vector<rb::Vector3> oldCPos;
|
||||
|
||||
public:
|
||||
|
||||
void movechild() override;
|
||||
|
||||
PivotJoint(PieceInterface* father,std::vector<PieceInterface*> childs, rb::Vector3 pivotPoint);
|
||||
~PivotJoint();
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "joint_interface.hpp"
|
||||
|
||||
|
||||
class RigidJoint : public JointInterface {
|
||||
protected:
|
||||
void rotate(unsigned int id) override;
|
||||
void traslate(unsigned int id) override;
|
||||
|
||||
//possono servire per calcolare l'offset rispetto alla posizione precedente
|
||||
rb::Vector3 oldPos;
|
||||
std::vector<rb::Vector3> oldCPos;
|
||||
|
||||
public:
|
||||
|
||||
void movechild() override;
|
||||
|
||||
RigidJoint(PieceInterface* father,std::vector<PieceInterface*> childs);
|
||||
~RigidJoint();
|
||||
};
|
||||
Reference in New Issue
Block a user