Sign in to follow this  

effects of negative values

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ive got some code that works fine when VCamPos > 0... but not when VCamPos < 0... i solve this a bit ugly through setting the initial value VCamPos = 10000 (which will not go under 0 in the application)... but how can i remove the effect of negative values when i have the intial value VCamPos = 0
						LVCamPos = VCamPos;
						OVCamPos = UpdateOffset/ClipSize;
						VCamPos += OVCamPos;
			

						float xFrom = fract(VCamPos.x-0.5f-fabs(OVCamPos.x));
						float xTo	= xFrom + fabs(OVCamPos.x);					

						float zFrom = fract(VCamPos.z-0.5f-fabs(OVCamPos.z));
						float zTo	= zFrom + fabs(OVCamPos.z);	



Share this post


Link to post
Share on other sites
im sry for being so unclear...

basicly it updates a heightmap based on the camera position...

it takes the camera position for the last update, LVCamPos.
the current camera position, VCamPos, and the difference between the both Updateoffset


now everything works fine when i move the camera forward or backward as long as the position is > 0... however as soon as the pos is < 0... i get all wrong values... what id like to accomplice is that it should give me the same values even if its negative...

for example if i have the last update (initial) pos at 1.5 and the current pos at 0.5 (-1 updateoffset) i want to get the same result as if the last update (initial) pos is at 0.5 and the current pos is at -0.5 (-1 updateoffset).. which isnt the case...

i hope this clears it out a bit

Share this post


Link to post
Share on other sites

This topic is 3740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this