Infinite rotation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Infinite rotation

Post by DanyATK »

I've tried make an infinite loop for rotate infinitely my mesh:

Code: Select all

if (player)
{
vector3df rotation = player->getRotation();
while(1)
{
rotation.Y += 1.0f;
}
player->setRotation(rotation);
[...]
But, code don't works beacause the program jams...
How I can make an infinite rotation??? thx :wink:
The best italian GM related site
www.gamemaker.it
yin nadie

Post by yin nadie »

You're not calling the render functions in that while loop, so the program just adds some value to the rotation vector and then again and again and again... It doesn't actually draws anything on screen
elhim
Posts: 16
Joined: Sat Mar 13, 2004 12:37 am
Location: LI, NY

Post by elhim »

but if you rotate it every frame the rotation speed depends directly on the FPS. so is you have variable fps, you'll have variable rotation speeds. unless that's okay with you, i think this needs a rotation animator, which doesn't exist.
rincewind
Posts: 35
Joined: Thu Mar 25, 2004 5:28 pm
Location: Germany --> Bonn

Post by rincewind »

elhim wrote:but if you rotate it every frame the rotation speed depends directly on the FPS. so is you have variable fps, you'll have variable rotation speeds.
There is a short tutorial about "timing and movement" by Isometric God, which can be found here
elhim wrote: ... i think this needs a rotation animator, which doesn't exist.
You can create a RotationAnimator with the ISceneManager::createRotationAnimator(const core::vector3df &rotationPerSecond) method and attach it to a SceneNode with ISceneNode::addAnimator(animator).

greetings, rincewind
LEFRANCAIS
Posts: 28
Joined: Wed Oct 08, 2003 9:09 am
Location: Annecy - FRANCE

Post by LEFRANCAIS »

code:
--------------------------------------------------------------------------------

if (player)
{
vector3df rotation = player->getRotation();
while(1)
{
rotation.Y += 1.0f;
if(rotation.Y >360) rotation.Y =1.0f //360° MAXI
}
player->setRotation(rotation);
[...]

--------------------------------------------------------------------------------
Post Reply