simple turnentity loop problem

Blitz3D Forums/Blitz3D Programming/simple turnentity loop problem

shawnus(Posted 2004) [#1]
I am using a sprite (via a camerapick function) to control the rotation of part of a model that has been set up in a parent/child hierarchy.

When the mouse is over the sprite, this triggers a turnentity command to rotate part of the model (rotateentity seems to move the model around global co-ords so I cant use it).

The problem is, I want the model to stop rotating at a particular point, but while the mouse is over the sprite the turnentity command keeps rotating the model.

I have tried various loop structures without success & I now seem to have developed a real mental block about this one. Can anyone point me in the right direction?

Cheers Shawnus


semar(Posted 2004) [#2]
Use a flag to toggle between rotation and still. For example, a pseudo code would be:

Global turnflag = 1
Const MyToggleKey = 57 ;space bar

if mouse is over the sprite then
   if turnflag = 1 then
      turnentity myentity, a,b,c
   endif
endif

if keyhit (MyToggleKey) then
   turnflag = 1 - turnflag
endif


Hope this has sense for you,
Sergio.


shawnus(Posted 2004) [#3]
Thanks Sergio, I will try on Monday.
Cheers Shawnus