Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

fireking

help, my demo has bad-earthquake syndrome

This topic is 5482 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

ok finally, i have 3rd person camera up and running (kind of), and now when i walk across my terrain, i experience a rather yucky earthquake... here''s how everything is being calculated: Get Height at current point and set the model''s height to that number (so that the model is standing on the terrain) g_3DModel.Position.y=(Height(g_HeightMap,g_3DModel.Position.x/SCALE,g_3DModel.Position.z/SCALE)*(SCALE*HEIGHT_RATIO))+35; right now, Scale is 10, height Ratio is 1.2, and 35 is half the height of the model (i think) anyways, everything works fine, until i start walking, in which the camera shakes up and down vigurously as if a dog was fighting for a peice of my bare ass... how do games have a 3rd person camera be so smooth? here is how i calculate the third person camera... void CCamera::SetThirdPerson(float xpos,float yrot,float zpos) { m_vPosition.x=400 * sin((yrot-90) * M_PI / 180) + xpos; m_vPosition.z=400 * cos((yrot-90) * M_PI / 180) + zpos; } xpos is passed with model''s x position, y rot is passed with model''s direction (in degrees), and zpos is passed with model''s z position.. i dont know why i had to add the -90 in there, because the 3rd person camera tutorial i read just says (yrot) instead of (yrot-90), but without it, the camera will only be on the side of the model, instead of behind it...

Share this post


Link to post
Share on other sites
Advertisement
those are radians, degrees converted to radian is

radian = (pie / 180) * the number in degrees that you want to convert

thats not my problem

my problem is that as you walk forward, you pass the bumps on the terrain, so the height is constantly changing and it looks like there''s an earthquake cuz the height is changing as you move foward..

i need either a better way of clinging to the terrain, or, some kind of smooth transition...

i have no clue where to start

Share this post


Link to post
Share on other sites
It looks like you are just extracting the nearest height value from the height map. What you need to do is pick the nearest 4 and interpolate the value from them so that you smoothly change height reguardless of which direction you travel.

Share this post


Link to post
Share on other sites
an example perhaps, Extrarius?

sorry, im kind of new at buildling my own engine, i''ve never had to program movement before (ive mostly used engine throughout my game development career, where movement functions are already defined and you just plug and play)

Share this post


Link to post
Share on other sites
fireking, feel free to download our latest source package, it has an example of how to do this...

http://mtrp.juntadigital.com

you want the testclient_src.zip package, and what you''re looking for is in a function called GetHeightAt() in terrainrenderer.cpp.

What you''re doing is a 2d lerp between the 4 points

Share this post


Link to post
Share on other sites
what are your sectors for (define them)? this example you''ve given me might have too much overhead for me to apply to my demo, because you got a whole crap load going on there

Share this post


Link to post
Share on other sites
btw, thats a cool little game you got goin on there, was i really playing online? i couldnt tell... but anyways, nice work so far

Share this post


Link to post
Share on other sites
pls disregard my post if you catched it fireking, i was tired and i think it might be wrong.. just don''t got enough caffine in me to think about that right now.

Share this post


Link to post
Share on other sites

  • 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!