0
votes

I got my rotation values from OPI0 to my pc and now i want to get a object to rotate in that direction where my gyroscope is facing (degree values from 180 to -180) Im fairly new to Python. glRotatef(1, xrot, yrot, zrot) Only sets the rotation + the current rotation. But what i actually want to have is that if it is on 180 degrees, i want to place it to 180 degrees. This could be archieved by getting the current rotation, testing if its smaller or largen and then adjust the rotation or setting the rotation with a command to the degree value. So my main questions are: Is there a command to set the rotation value of the created object? Is there a way to read the current rotation value?

1

1 Answers

0
votes

Well, if you

glLoadIdentity()

before

glRotatef()

then it should always rotate to the specified degrees, instead of relatively rotating.

Depending on how and where you've setup your camera and object translation, you might have to refactor your code a bit, because of the identity (it will clear all other transformations you done before).