Looking for Camera 'Quake n Shake' Code

Blitz3D Forums/Blitz3D Programming/Looking for Camera 'Quake n Shake' Code

Techlord(Posted 2004) [#1]
Looking for Camera 'Quake n Shake' aka RumbleCam with variable intensity.


jhocking(Posted 2004) [#2]
What does "quake n shake" mean? What is "rumblecam?" Could you perhaps describe what it is you want?


Paul "Taiphoz"(Posted 2004) [#3]
this is easy me.

positionentity cam,cam\x+rnd(-1,1),cam\y+rnd(-1,1),cam\z+rnd(-1,1)

Simple as that. if you want to be able to set the amount of rumble just replace the 1's with a var.]

It works really well cos I use it for one of my games.


jfk EO-11110(Posted 2004) [#4]
You might use a variable in the rnd parameters that is decreasing in a second or two down to zero, so it looks like the quake is ending slowly.


Techlord(Posted 2004) [#5]
jhocking,

Quake n Shake or RumbleCam is the effect of shaking the camera to give emphasis to explosions, impact, and earthquakes.

Yavin, jfk

Thanks. I'll play with the code and see what I come up with.


Techlord(Posted 2004) [#6]
Function cameraRumble(this.camera,x#,y#,z#)
	RotateEntity this\entity%,EntityPitch(this\entity%)+Rnd(-x#,x#),EntityYaw(this\entity%)+Rnd(-y#,y#),EntityRoll(this\entity%)+Rnd(-z#,z#) 
	;adjust & play rumble bass
End Function



Techlord(Posted 2004) [#7]
Looking for a deep bass note to complement the rumble cam.


sswift(Posted 2004) [#8]
RotateEntity this\entity%,EntityPitch(this\entity%)+Rnd(-x#,x#),EntityYaw(this\entity%)+Rnd(-y#,y#),EntityRoll(this\entity%)+Rnd(-z#,z#)


You know there is a turnentity() command there for a reason. :-)

That said, I don't reccomend you rotate the camera for your shake. Just move it about. Turning it will probably make a lot of players sick, and objects in the distance will move about a lot more than objects up close. Also, in movies, the effect is done my shaking the camera, not by tilting it, and people often expect what they've seen in movies, rather than what might happen in real life.

Of course, it's just a suggestion. Rules are made to be broken. :-)


_PJ_(Posted 2004) [#9]
What about the 'earthquake effect' thingy in the code archives???

Ive not even tried it myself, but I keep noticing it...


Techlord(Posted 2004) [#10]
sswift,

RotateEntity provides the desired effect.

Malice,

I place the earthquake effect snippet in the archives:)


sswift(Posted 2004) [#11]
"RotateEntity provides the desired effect."

Yes, but if I'm not mistaken, you could replace all of this:

RotateEntity this\entity%,EntityPitch(this\entity%)+Rnd(-x#,x#),EntityYaw(this\entity%)+Rnd(-y#,y#),EntityRoll(this\entity%)+Rnd(-z#,z#)


With this:

TurnEntity this\entity%,Rnd(-x#,x#),Rnd(-y#,y#),Rnd(-z#,z#)


Techlord(Posted 2004) [#12]
sswift,

Swap it and works great. thanx