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.

Author
Message
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 4th Feb 2014 08:47 Edited at: 4th Feb 2014 08:47
Hi guys, i have this wierd bug with the mentioned plugin.

I've got group of objects(4 in each group) and i'm checking if the user pick one from the group.If he does, i check for condition, get all of the objects in the group and make a rotation, there are 6 groups every object participate in 3 groups, every rotation have 18 frames and rotation step is 5 degrees.18*5 = 90!This is how i do this and i'm open for suggestions, including optimization if someone knows better way to do it:



Here is my EZRotate function for rotation, there are fractions added or subtracted where necessary else it's even worse.Sometimes i get +/-5 degrees sometimes +/-9 deviation in angle values shown, although the objects in the groups are perfectly aligned as if there is no such thing.

The function:



The code above shows, rotation on Y axis, there are 2 other,exactly the same for X, and Z.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 8th Feb 2014 01:55
I didn't notice anything strange, is it because eulerx ,eulery ,eulerz should be float values: eulerx# ,eulery# ,eulerz#

I made this code for fun only:



luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 9th Feb 2014 13:58 Edited at: 9th Feb 2014 16:23
Didn't even notice that i use integers there, stupid me.Now i have a workaround of the problem with the angles, but i will try to see if making those variables floats does any good.I came up with some ugly function that sort objects in groups using their position and checks if the objects in the group are the right ones, if all six groups of objects are in place a condition is met, this is yet another solution of the problem.I'll definitely check your code later.

EDIT:You can see what i mean in your own example.I added few text lines to show you what i mean.Just hover the mouse over an object and rotate it 360, it should be at starting position now but the angles are different.Why is that?



Coding is My Kung Fu!
And My Kung Fu is better than Yours!
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 10th Feb 2014 10:55 Edited at: 10th Feb 2014 11:00
Quote: "Sometimes i get +/-5 degrees sometimes +/-9 deviation in angle values shown, although the objects in the groups are perfectly aligned as if there is no such thing."
That is due to floating-point inaccuracy. Are you sure its off by as much as +/-9? The deviations i see are in the neighborhood of "-9.22081089811e-005". Note the "e-005" at the end, that indicates that the decimal point should be moved to the left 5 places making the actual value "-0.0000922081089811". That value outside the range of floating point decimals so DB kicks in and gives us that nice notation instead.

It is your code to fix these deviations that breaks the example. If you replace
with
the rotation problems go away.
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 11th Feb 2014 00:04
If we rotate in one plane no problem.If we rotate in more than one see what happens:


Coding is My Kung Fu!
And My Kung Fu is better than Yours!
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 11th Feb 2014 01:29 Edited at: 11th Feb 2014 11:08
Again its this ->
section of code that is messing with the rotations. I see you've removed the +0.5(s), but it is only updating your values if the new angle isn't equal to zero.
I didn't realize that when dbpro uses the "e-???" notation, that those values would be considered as being equal to zero but it seems to be the case. Completely replace those conditional statements with
and the problems go away.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Feb 2014 10:51
I think luskos found the same issue I thought of when reading the first post... you are not accounting for the current position and compensating...

Well thought it was worth mentioning for future readers...

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 11th Feb 2014 21:42 Edited at: 11th Feb 2014 21:43
Again with revenant's code :


Coding is My Kung Fu!
And My Kung Fu is better than Yours!
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 12th Feb 2014 07:26 Edited at: 12th Feb 2014 07:40
Those inaccuracies are building up and causing your values to become a more and more wonky with each rotation. My first thought is to manually correct those values after each full 90degree rotation has completed.



[edit] Re-indented the code using only tabs in hopes of improving its appearance within the codebox
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 12th Feb 2014 10:42
I think that last code snipped nailed it.Very elegant solution thank you!

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 12th Feb 2014 10:52
You are very welcome, glad I could share some of my Kung Fu

Login to post a reply

Server time is: 2026-07-07 05:38:45
Your offset time is: 2026-07-07 05:38:45