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.

DarkBASIC Discussion / A steady Curveangle?

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Dec 2008 17:56
Hello!

I am having problems with slowly angling the current angle to the destination angle.

I need a curveangle command, but it should be steady(not decrease in speed as it gets closer to the destination). I need it to always rotate in steps of four.

Is this possible? Keep in mind that I am using wrapped values...

TheComet

Peachy, and the Chaos of the Gems

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th Dec 2008 00:14
Approach it just like you would if you were rotating an object or the camera using arrow keys. As long as the key is pressed, you inc or dec the yangle a certain number of units. So, until current angle = destination angle, increment or decrement current angle a uniform amount. Because it's possible to pass the destination angle, check to see if the current angle is within a certain range of the destination angle. Turn off wrap for the calculations and turn it on for the rotations.
if abs(destination-current) is < 1 or whatever, then current=destination.

Enjoy your day.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th Dec 2008 20:13
Hmm, well, I need it to go the shortest direction. I tried using this:



But all my tank does is jiggle back and forwards...

And that is because of the wrapped value... I think I have an idea, but it probably won`t work. If it does, I will post it.

TheComet

Peachy, and the Chaos of the Gems

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th Dec 2008 21:08
I ran a few tests. This seems to work. You might want to test it more.




Enjoy your day.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th Dec 2008 21:42
Hey, cool Latch! That`s exactly what I need. Thanks a bunch!

TheComet

Peachy, and the Chaos of the Gems

Login to post a reply

Server time is: 2025-06-07 20:27:28
Your offset time is: 2025-06-07 20:27:28