camera walking

Blitz3D Forums/Blitz3D Programming/camera walking

gellyware(Posted 2004) [#1]
Hey, Can anyone explain how to make the camera feel like its a human walking? Ive tried numerous things and keep failing. Also tried searching the forums and cant find anything. I just want a subtle up an down motion if the up or down arrow keys are pressed. Can anyone help?


Ross C(Posted 2004) [#2]
Hey man, msn ain't workin :S

Try using sin for a walking movement. Have an angle variable and feed it into the camera height.

positionentity camera,entityx(camera),sin(angle),entityz(camera)


Just keep incrementing the angle variable :)


MadJack(Posted 2004) [#3]
If you wanted to go the 'whole hog', find an animated, walking model and attach the camera to the 'ead.


Bot Builder(Posted 2004) [#4]
Mod of Ross C's code. set coeff quite low (below 1) although it depends on your scale.
positionentity camera,entityx(camera),entityy(camera)+sin(angle)*coeff#,entityz(camera)



N(Posted 2004) [#5]
You can always use my code for player movement.

It's under vein-src.zip on http://s87776868.onlinehome.us/vein/vein-src.zip
Not exactly the cleanest code to look at, but in my opinion it does the job.


Shambler(Posted 2004) [#6]
I had camera bobbing in my engine but it made me feel ill so I took it out =)

Irl although your head bobs up and down you don't see like that becuase your eyes focus on a fixed object so I would include the option to turn this off.


Neochrome(Posted 2004) [#7]
used a Cos

SpeedX# = .5 ; Adjust These
SpeedY# = .6 ; Adjust these

headrot = (headrot + Speedx#) mod 300 ; give a stepping feel
headrot2 = (headrot + Speedy#) mod 360 ; full side to side feel
headbobx = cos(headrot) * 6 ; updown
headboby = cos(headrot2) * 2 ; not to much other wise you get the rude boy walk! LOL

; then

positionentity headcam, entityx(player), entityy(player), entityz(player)
moveentity headcam, headbobx, headboby,0


try this, it works nicely for me, i'v got a small demo i'll upload it tonight ;)


Mustang(Posted 2004) [#8]
So... where's the demo? :)


mrtricks(Posted 2004) [#9]
I use the camera MOVING in a sinwave (shape of an "n"), and also PANNING in a figure of 8 sin wave. You can even have the camera rolling on the z axis in a sinwave but that should be very small. If it starts to make you feel a bit sick then tone it down. It should all be really quite small.

If you're doing walking and running then obviously it should speed up and slow down (but the rate of the sinwave does not correspond to the speed of walking - you need trial and error to find out the best rates) and also when running, the sinwaves should be a little bigger.

Also, if you have a gun in shot like most FPS's, that needs to move on a sinwave as well, parented to the camera.


Neochrome(Posted 2004) [#10]
Sorry, demo didn't work, im re-writing it :o(

going to be a few days.. !agh!

i made the code too complicated for a demo