Add rotation function

This commit is contained in:
Wellinator
2021-04-08 08:33:06 -03:00
parent e43fae88e8
commit b749a80a25
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -1,4 +1,5 @@
.vscode/ .vscode/
.idea/
# --- # ---
+9
View File
@@ -25,6 +25,7 @@ Cube::Cube( TextureRepository *t_texRepo )
void Cube::update(const Pad &t_pad, const Camera &t_camera) void Cube::update(const Pad &t_pad, const Camera &t_camera)
{ {
rotate(t_pad);
Vector3 *nextPos = getNextPosition(t_pad, t_camera); Vector3 *nextPos = getNextPosition(t_pad, t_camera);
} }
@@ -55,4 +56,12 @@ Vector3 *Cube::getNextPosition(const Pad &t_pad, const Camera &t_camera)
result->z += -normalizedCamera.x; result->z += -normalizedCamera.x;
} }
return result; return result;
}
void Cube::rotate(const Pad &t_pad){
//if (t_pad.rJoyH >= 200)
//else if (t_pad.rJoyH <= 100)
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.01;
mesh.rotation.z += 0.01;
} }
+1
View File
@@ -20,6 +20,7 @@ class Cube
private: private:
TextureRepository *texRepo; TextureRepository *texRepo;
Vector3 *getNextPosition(const Pad &t_pad, const Camera &t_camera); Vector3 *getNextPosition(const Pad &t_pad, const Camera &t_camera);
void rotate(const Pad &t_pad);
float speed; float speed;
}; };