forked from Phobos-developers/YRpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BounceClass.h
62 lines (49 loc) · 1.57 KB
/
BounceClass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
Ballistic trajectory data used by Animations and Voxel Animations.
*/
#pragma once
#include <GeneralStructures.h>
#include <YRMathVector.h>
#include <Quaternion.h>
class BounceClass
{
public:
enum class Status : int {
None = 0,
Bounce = 1,
Impact = 2
};
// constructors
BounceClass() = default;
BounceClass(const CoordStruct& coords, double elasticity, double gravity,
double maxVelocity, const Vector3D<float>& velocity, double angularVelocity)
{
this->Initialize(coords, elasticity, gravity, maxVelocity, velocity, angularVelocity);
}
void Initialize(const CoordStruct& coords, double elasticity, double gravity,
double maxVelocity, const Vector3D<float>& velocity, double angularVelocity)
{ JMP_THIS(0x4397E0); }
CoordStruct* GetCoords(CoordStruct* pBuffer) const
{ JMP_THIS(0x4399A0); }
CoordStruct GetCoords() const {
CoordStruct buffer;
this->GetCoords(&buffer);
return buffer;
}
Matrix3DStruct* GetDrawingMatrix(Matrix3DStruct* pBuffer) const
{ JMP_THIS(0x4399E0); }
Matrix3DStruct GetDrawingMatrix() const {
Matrix3DStruct buffer;
this->GetDrawingMatrix(&buffer);
return buffer;
}
Status Update()
{ JMP_THIS(0x439B00); }
double Elasticity{ 0.0 }; // speed multiplier when bouncing off the ground
double Gravity{ 0.0 }; // subtracted from the Z coords every frame
double MaxVelocity{ 0.0 }; // 0.0 disables check
Vector3D<float> Coords; // position with precision
Vector3D<float> Velocity; // speed components
Quaternion CurrentAngle; // quaternion for drawing
Quaternion AngularVelocity; // second quaternion as per-frame delta
};