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.

AppGameKit Classic Chat / smooth rotation AGK

Author
Message
zootan
14
Years of Service
User Offline
Joined: 12th Apr 2010
Location:
Posted: 17th Sep 2018 06:57
hi , trying to make the model slowly turn to its dummy objects angle, used wrap-value in dbp but on agk im lost , how do i get this to work
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 17th Sep 2018 09:40
The way I've always done it was with a simple check:

X# = anglevalue#
Select x#
Case x#=>360.0
X#=x# - 360.0
Endcase
Case x#<0.0
X#=x# + 360.0
Endcase
Endselect


There's probably an easier or better way to do it, but this always worked for me. Or you could just do a couple of if statements:

X# = anglevalue#
If x#=>360.0 then x#=x# - 360.0
If x#<0.0 then x#=x# + 360.0
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 17th Sep 2018 20:44
DBpro commands

The coffee is lovely dark and deep,and I have code to write before I sleep.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Sep 2018 20:53 Edited at: 17th Sep 2018 20:56
So write a wrap value command!



Don't use a loop for calculating this value, it's horribly inefficient. Calculate the range and "mod" your input by the range to get the remainder. Basically the same thing Stab's loop is doing.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
zootan
14
Years of Service
User Offline
Joined: 12th Apr 2010
Location:
Posted: 17th Sep 2018 23:01
thanks for replies guys !
i got something working
if ceil(getobjectangley(scoutobj) > getobjectangley(scoutobj+1000)) then difA = ceil(getobjectangley(scoutobj) - getobjectangley(scoutobj+1000))
if ceil(getobjectangley(scoutobj) < getobjectangley(scoutobj+1000)) then difB = ceil(getobjectangley(scoutobj+1000) - getobjectangley(scoutobj))
if difA >1 then rotateobjectlocaly(scoutobj,-1) : difA=0
if difB >1 then rotateobjectlocaly(scoutobj,-1) : difB=0

Login to post a reply

Server time is: 2024-04-25 06:25:33
Your offset time is: 2024-04-25 06:25:33