🔒 Locked
Camera Shake Help
Advertisement
Original Post
Hey all, Ok so I'm trying to add a camera shake method to my camera class and I'm having a few problems. First off I'm using Directx 9.0c and its basically a 2D Side Scroller so I want the camera to shake when a bomb or explosion happens within a certain distance from the player. So does anyone have an algorithm or any suggestions on how to correctly "shake" the camera? Anyone? Thanks!
Quote:It sounds to me like it's a 2-d game (side-scroller), in which case camera-obstacle interference isn't likely to be an issue.
Original post by eq
I advice against moving the camera since this could move the camera through objects (walls etc) unless you also add a collision avoidance step.
It's better IMO to rotate the camera.
Yea there is no worry about the camera having any collision issues. I'll try moving it back and forth like you suggested. I guess I'm still a little confused on how it works. Won't it have to do something like this:
Move Camera
Render Scence
Move Camera
Render Scene
Move Camera
Render Scene
Do I just do this for a certain amount of specified time or until the DeltaMove is equal to zero? Thanks!
Move Camera
Render Scence
Move Camera
Render Scene
Move Camera
Render Scene
Do I just do this for a certain amount of specified time or until the DeltaMove is equal to zero? Thanks!
Quote:
Yea there is no worry about the camera having any collision issues. I'll try moving it back and forth like you suggested. I guess I'm still a little confused on how it works. Won't it have to do something like this:
Move Camera
Render Scence
Move Camera
Render Scene
Move Camera
Render Scene
nah, assuming u are using win32 application,
u should hv a main message loop, where u update and render everything
its a bad habit to update and render things one by one IMO
// main msg loop
while(...)
{
everything.update();
device->beginScene(...);
everything.render();
device->...
...
}
Quote:
Do I just do this for a certain amount of specified time or until the DeltaMove is equal to zero? Thanks!
its all up to u
if u are going to use zedz's equations,
if(shake_horizontal_magnitude <= "a certain amount")
{
shake_horizontal_magnitude = 0;
SHAKING = false;
}
cheers for the rotation on the z axis idea (I didnt think of that)
though I've just now tried it + personally it doesnt look as good as side to side
shaking shouldnt affect clipping into the scenery as if clipping is an issue u should already be handling it.
>>if(shake_horizontal_magnitude <= "a certain amount")
...
...
I wouldnt even worry about if the camera is shaking or not, I apply shaking to the camera every frame, i.e. even if visually 99.99% u dont see it.
KISS
though I've just now tried it + personally it doesnt look as good as side to side
shaking shouldnt affect clipping into the scenery as if clipping is an issue u should already be handling it.
>>if(shake_horizontal_magnitude <= "a certain amount")
...
...
I wouldnt even worry about if the camera is shaking or not, I apply shaking to the camera every frame, i.e. even if visually 99.99% u dont see it.
KISS
Quote:
Original post by clivehk
nah, assuming u are using win32 application,
u should hv a main message loop, where u update and render everything
its a bad habit to update and render things one by one IMO
// main msg loop
while(...)
{
everything.update();
device->beginScene(...);
everything.render();
device->...
...
}
Ok, I think I have it setup somewhat correctly. I have my "everything" class and a music class in my main message loop. Then in my "everything" class I call the rest of my objects so I think I'm good there. I'll try to implement the camera class like u suggested and see what happens. Thanks for the help!
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement