Camera shake.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Camera shake.
Is it possible to create a little camera shake effect in DECORATE? I want to make sprinting for my mod and I wanted the camera to shake a little when the player's feet supposedly touches the ground.
Last edited by bleant on Thu Apr 14, 2011 3:05 pm, edited 1 time in total.
- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: Camera shake.
Uh...A_SetAngle and A_SetPitch, perhaps? Possibly also combined with A_ZoomFactor.
Re: Camera shake.
I guess they won't do because you set specific values for them, it will face where you tell it to, all I want is the camera to tremble a little, jump, and watch as your head shakes a little and so does your view.
*sigh* Maybe use Recoil?
*sigh* Maybe use Recoil?
- chopkinsca
- Posts: 1325
- Joined: Thu Dec 11, 2003 5:03 pm
Re: Camera shake.
[wiki]Random[/wiki]bleant wrote:I guess they won't do because you set specific values for them, it will face where you tell it to,
- NeuralStunner
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Camera shake.
[wiki=DECORATE_expressions]FRandom[/wiki].chopkinsca wrote:[wiki]Random[/wiki]

- chopkinsca
- Posts: 1325
- Joined: Thu Dec 11, 2003 5:03 pm
Re: Camera shake.
Oh yeah, I always forget about floating point values.NeuralStunner wrote:[wiki=DECORATE_expressions]FRandom[/wiki].chopkinsca wrote:[wiki]Random[/wiki]
Re: Camera shake.
And the difference is!? I'm not very good at this, how do i use them?
*probably by adding them in the end of the code*
I'm not stupid ok? I just ain't very good at english as it's my second language, and i don't know what integer and floating is
*probably by adding them in the end of the code*
I'm not stupid ok? I just ain't very good at english as it's my second language, and i don't know what integer and floating is

- NeuralStunner
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Camera shake.
Anywhere you'd use a number, you can use FRandom(Min,Max). An integer is a whole number, like 2 or 4. A float is a decimal number like 2.5 or 4.2, and those are used for more precise numbers like angles.bleant wrote:And the difference is!? I'm not very good at this, how do i use them?
Just for the record, this isn't really necessary. Anyone that would laugh you off for a valid question is going to do it anyway, despite this insistence.bleant wrote:I'm not stupid ok?
- ChronoSeth
- Posts: 1631
- Joined: Mon Jul 05, 2010 2:04 pm
- Location: British Columbia
Re: Camera shake.
An integer is a whole positive or negative number (ie -7).
A floating point value is any number with a decimal (ie 0.3).
One thing you might find useful is [wiki]Radius_Quake[/wiki]... it's technically an ACS function, but can be used in DECORATE (is there a decorate-specific version of this?).
Edit: Damnit
A floating point value is any number with a decimal (ie 0.3).
One thing you might find useful is [wiki]Radius_Quake[/wiki]... it's technically an ACS function, but can be used in DECORATE (is there a decorate-specific version of this?).
Edit: Damnit
Re: Camera shake.
lolEdit: Damnit
Oh, thanks! Let' just be good friends, grab a beer, err, coke and feel like you're home.
Pitch has to do with vertical and angle has to do with horizontal, is that it?
- NeuralStunner
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Camera shake.
Yep!bleant wrote:Pitch has to do with vertical and angle has to do with horizontal, is that it?
Re: Camera shake.
I have one more thing for you guys, is it possible to make the player's POV go back to normal? I want it to shake, but i also want it to go back to normal, because if it doesn't then the player's running direction will mess up, i think i will need to use A_SetAngle and A_SetPitch without random values, but predefined ones.
- NeuralStunner
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Camera shake.
You can use [wiki]A_SetArg[/wiki] to store the Player's current Pitch and Angle in a couple of their args:
Args are integers, so multiplying them by a million should* let you maintain a few decimal places for precision.
When you want to restore the original values:
* If anyone knows otherwise, the information would be appreciated.
Code: Select all
WOOT A 0 A_SetArg (3, Angle * 1000000)
WOOT A 0 A_SetArg (4, Pitch * 1000000)
When you want to restore the original values:
Code: Select all
WOOT A 0 A_SetAngle (Args[3] / 1000000.0)
WOOT A 0 A_SetPitch (Args[4] / 1000000.0)
Re: Camera shake.
Wait, what?
I did not understand *bangs head on wall*
Don't post yet, i'm processing the information...
Yeah, i did not understand, your explanation is conflicting with the wiki's in my head, in the wiki it says that arg sets a position(which i have no idea of what position it's talking about) to a value, how would i use it to store the value?
I'm misunderstanding it
I did not understand *bangs head on wall*
Don't post yet, i'm processing the information...
Yeah, i did not understand, your explanation is conflicting with the wiki's in my head, in the wiki it says that arg sets a position(which i have no idea of what position it's talking about) to a value, how would i use it to store the value?
I'm misunderstanding it

Re: Camera shake.
You can use actual variables now, so I don't think you need to deal with args. http://zdoom.org/wiki/A_SetUserVarNeuralStunner wrote:You can use [wiki]A_SetArg[/wiki] to store the Player's current Pitch and Angle in a couple of their args:Args are integers, so multiplying them by a million should* let you maintain a few decimal places for precision.Code: Select all
WOOT A 0 A_SetArg (3, Angle * 1000000) WOOT A 0 A_SetArg (4, Pitch * 1000000)
When you want to restore the original values:* If anyone knows otherwise, the information would be appreciated.Code: Select all
WOOT A 0 A_SetAngle (Args[3] / 1000000.0) WOOT A 0 A_SetPitch (Args[4] / 1000000.0)
Edit: Holy **** we can use arrays in DECORATE too!!