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 / Drawing a blank on rotation

Author
Message
MatriX
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: Deer Park, New York
Posted: 24th Nov 2003 01:29
If I have an object that I am rotating from 5 degrees to 355 I would want to rotate it counter-clockwise. If I want to go from 5 degrees to 10 degrees I would want to rotate it clock wise. How would I write a program that tests which direction to go based on angular distance so that I don't rotate in the wrong direction? I feel like this is simple and I've seen it a million times but can't seem to figure it out or find it in the forums.

With all things in life - try hard. Success does not come with meeting the minimum requirements.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 24th Nov 2003 02:12
One idea may be to have a variable related to that object that you can test. So, whenever you go to move the object you also update the variable to keep track of it.
--
TAZ
MatriX
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: Deer Park, New York
Posted: 24th Nov 2003 02:50 Edited at: 24th Nov 2003 03:22
Here's code that works in some instances but it's not smart enough to go the shortest distance. I know that I can some how use wrapvalue but can't figure it out.



With all things in life - try hard. Success does not come with meeting the minimum requirements.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Nov 2003 03:13
isn't there a Object Angle x/y/z command? Just use it to get your object's current angle, then do the rotation accordingly.

just a thought

-RUST-
MatriX
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: Deer Park, New York
Posted: 24th Nov 2003 03:32
Yeah I was using variables to demonstrate the problem.

To clarify, my problem is that the object starts at 5 degrees goes 5,6,7 etc. until it gets to 350 because 5 is lower than 350. I would like logically to have it decide that its shorter to go 5,4,3,2,1,359 etc. until it gets to 350 being that that is the shorter distance.

With all things in life - try hard. Success does not come with meeting the minimum requirements.
MatriX
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: Deer Park, New York
Posted: 24th Nov 2003 05:07
Hmm I think using ATANFULL has solved my problem..

With all things in life - try hard. Success does not come with meeting the minimum requirements.

Login to post a reply

Server time is: 2024-11-25 18:53:45
Your offset time is: 2024-11-25 18:53:45