Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rotation to mesh #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions terrain_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down