Answer the question
In order to leave comments, you need to log in
Make a single rotation around an axis?
void Scene1::ShowDrum(int countdrums,int counttextureondrums,std::vector<std::string> drum, bool*buttons)
{
....
if (buttons[2]) {
StartRotate();
}
Rotate();
....
}
void Scene1::Rotate()
{
for (int i = 0; i<CountDrum; i++)
{
if (startrotate[i])
{
if (rotate[i]<360.0f)
rotate[i] += 5.0f;
else
{
startrotate[i] = false;
rotate[i] = 0.0f;
}
}
}
}
void Scene1::StartRotate()
{
for (int i = 0; i<CountDrum; i++)
{
if (startrotate[i] && rotate[i] != 0.0f)
continue;
startrotate[i] = true;
rotate[i] = 0.0f;
}
}
Answer the question
In order to leave comments, you need to log in
Added a pressbutton variable that increases by 1 if a key (keyboard or mouse) is held down, because of which it becomes larger and when released, the variable turns to 0.
if (buttons[2] && pressbutton == 1) {//то есть один раз нажали стала 1 можно начинать крутить
StartRotate();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question