From 892c9febbfae7b0f6c075c0eb8bcdc6a6c810bfa Mon Sep 17 00:00:00 2001 From: keventhen4 Date: Sun, 14 Jul 2024 14:51:47 -0700 Subject: [PATCH] Add rotation to mesh --- terrain_audio.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terrain_audio.py b/terrain_audio.py index b81a225..a821afa 100644 --- a/terrain_audio.py +++ b/terrain_audio.py @@ -13,6 +13,7 @@ from opensimplex import OpenSimplex import pyqtgraph.opengl as gl from pyqtgraph.Qt import QtCore, QtGui +from PyQt5.QtGui import QQuaternion #Module required for rotation import struct import pyaudio import sys @@ -122,6 +123,11 @@ def update(self): verts, faces, colors = self.mesh(offset=self.offset, wf_data=wf_data) self.mesh1.setMeshData(vertexes=verts, faces=faces, faceColors=colors) + + q = QQuaternion(1, 0, 0, 1).normalized() #Can be changed for different rotation directions. Currently set to rotation around z-axis + axis = q.getAxisAndAngle() + self.mesh1.rotate(1, axis.x(), axis.y(), axis.z()) #1 is the angle of rotation every frame I believe + self.offset -= 0.05 def start(self):