Jump to content
  • Advertisement
Sign in to follow this  
Dragon_Strike

effects of negative values

This topic is 4026 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
Advertisement
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
If the result of the calculation should only depend on the updateoffset, then the positions shouldn't be involved in the formulas.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!