-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature PFD to update kinematics of a physical ETT
Add Strengh enum Rename Strength to Force. Add README for PFD. Clean unused dep and typedef moved to lib/lib.h
- Loading branch information
aTxr
committed
Jan 19, 2022
1 parent
4f4ce2e
commit fa55c83
Showing
7 changed files
with
42 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,19 @@ | ||
#ifndef PHX_PHX_H | ||
#define PHX_PHX_H | ||
|
||
#include <tuple> | ||
#include "lib/lib.h" | ||
#include <vector> | ||
#include <iostream> | ||
#include "entity/strategies/physical_entity.h" | ||
|
||
// Constrain | ||
// vitessePersoMax < longeurPersoMin | ||
|
||
// dependencies | ||
class Scene; | ||
class Entity; | ||
|
||
typedef std::pair<unsigned int, unsigned int> Vec; | ||
typedef std::pair<int, int> Vel; | ||
|
||
/** | ||
* Update each Entity in the Scene | ||
*/ | ||
void update(Scene); | ||
|
||
void updateCinematics(Entity&); | ||
void updateCollision(Scene); | ||
|
||
class Cinematics { | ||
private: | ||
Vec m_pos; | ||
Vel m_vel; | ||
}; | ||
Vel updateCinematics(PhysicalEntity const); | ||
|
||
class Hitbox { | ||
private: | ||
std::vector<Vec> m_vertices; | ||
}; | ||
|
||
class PhysicalParameters { | ||
private: | ||
std::vector<int> m_parameters; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#PHX | ||
|
||
- Use unsigned int from 0 to MAX_INT to calculate the physics | ||
- Positions are unsigned int pairs, Vectors are signed int pairs. These types are declared in lib. | ||
- updateCinematics act like the pfd. Do not take into account collisions. | ||
Param: PhysicalEntity | ||
Output: correction velocity to apply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "phx/phx.h" | ||
#include <vector> | ||
|
||
Vel updateCinematics(PhysicalEntity const ett) { | ||
Vel correction (0,0); | ||
Vel ett.getVelocity(); | ||
std::vector<Force> forces = ett.getForce(); | ||
|
||
for (auto force: forces) { | ||
switch(force) { | ||
case weight: | ||
correction.second += -10; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
|
||
return correction; | ||
} | ||
|