The problem I'm having originally stemmed from times where I was trying to set a node position but it kept getting changed automatically whenever ISceneManager->drawAll() was called. This wouldn't happen all the time, so it was pretty frustrating and time consuming to catch and understand.
For example, I would do something similar to this:
Code: Select all
node->setPosition(core::vector3df(123.456789, 0, 0));
printf("\n_DEBUG_POS_1_: %f\n", node->getPosition().X);
dvWindow->getSceneManager()->drawAll();
printf("_DEBUG_POS_2_: %f\n", node->getPosition().X);
So, as a work around I was trying to use fmod() to drop some of the decimal places and make the number more rounded. I ran into the exact same situation with this as well:
CALC:
Code: Select all
core::vector3df v3dNewTarget(123.456789, 0, 0);
printf("\n\n_NEW_TARGET_BEFORE_: %f\n", v3dNewTarget.X);
printf("FMOD: %f\n", fmod(v3dNewTarget.X, 0.0001));
printf("CALC: %f\n", v3dNewTarget.X - fmod(v3dNewTarget.X, 0.0001));
f32 temp = v3dNewTarget.X - fmod(v3dNewTarget.X, 0.0001);
printf("VAR: %f\n", temp);
v3dNewTarget.X = v3dNewTarget.X - fmod(v3dNewTarget.X, 0.0001);
printf("_NEW_TARGET_AFTER_: %f\n\n", v3dNewTarget.X);
Code: Select all
_NEW_TARGET_BEFORE_: 123.456787
FMOD: 0.000087
CALC: 123.456700
VAR: 123.456703
_NEW_TARGET_AFTER_: 123.456703
Maybe I'm completely missing something obvious and my mind is playing tricks on me. Is there a way to overcome this if it isn't something easy / obvious? My main issue with all of this is that I'm doing something client / server based and the server is storing the correct coordinates but sometimes (like above) the client changes the coordinate and the target is never reached.
Edit: I did find [THIS] thread earlier that I figured might have something to do with the sitation.
Thanks in advance for any input.