Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Rotating, rotate object, left right motion

Author
Message
Nights Bane
14
Years of Service
User Offline
Joined: 15th Dec 2009
Location:
Posted: 1st Nov 2010 22:26


Whats the solution to my problem here? - I'm trying to make an object (a plane, with a toony texture of a tree on it), and produce a rotate to the left, then stop and rotate right.

the effect is better explained by the very first moments of this video on youtube, some flowers do the same rotation (although i am going to exaggerate mine a bit more).

Here is the link.

The problem I encounter with zrotate is i increment a value to mark the rotation, but checking for a variable that 'Passes' zero has given me serious headaches! Also, I know how to offset a limb and can position the object 'mapSize*mapSize + 301' just fine. mapSize*mapSize + 301 is the object number incidentally. (I was messy in the early stages whenn i assigned numbers. this was my crude solution!)
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 1st Nov 2010 23:51
Well, to start with, your treeRotatePosition is zero, which fails both sets of while tests. If you make it check >= and <= you will pick up the zero position. Also, you're not delaying inside the test loop, which makes the movement very hard for me to see. Is Elapsed=0 meant to pause the movement at the end of each cycle? Try this...



You could even put in a curve value to make it ease into the stops.

Nights Bane
14
Years of Service
User Offline
Joined: 15th Dec 2009
Location:
Posted: 2nd Nov 2010 23:50
think about it tho, when the rotation reaches Zero. it passes the condition for '>=' and '<='...

The elapsed timer just controls the 'speed' of the motion, which is 1 second.

I tried your code and it seems to work, but i cannot fathom how it works exactly... How to implement the code using a timer function that doesnt slow down the entire program like the wait command has me confused too.. but I appreciate your input.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 3rd Nov 2010 08:07 Edited at: 3rd Nov 2010 08:09
Right, a timer works better. Here's a version using the timer...



I made the delay 10/1000ths to see it better, just substitute 1000 instead of 10 for a slower rate.

Login to post a reply

Server time is: 2024-09-28 22:27:47
Your offset time is: 2024-09-28 22:27:47