#### Archived

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

# 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.

## 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 on other sites
doest sin & cos take radians?

##### Share on other sites

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 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 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 on other sites
fireking, feel free to download our latest source package, it has an example of how to do this...

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 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 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 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.

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633312
• Total Posts
3011312
• ### Who's Online (See full list)

There are no registered users currently online

×