Camera shake.

Archive of the old editing forum
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.
User avatar
bleant
Posts: 224
Joined: Thu Jan 20, 2011 9:37 am

Camera shake.

Post by bleant »

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

Post by wildweasel »

Uh...A_SetAngle and A_SetPitch, perhaps? Possibly also combined with A_ZoomFactor.
User avatar
bleant
Posts: 224
Joined: Thu Jan 20, 2011 9:37 am

Re: Camera shake.

Post by bleant »

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?
User avatar
chopkinsca
Posts: 1325
Joined: Thu Dec 11, 2003 5:03 pm

Re: Camera shake.

Post by chopkinsca »

bleant wrote:I guess they won't do because you set specific values for them, it will face where you tell it to,
[wiki]Random[/wiki]
User avatar
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.

Post by NeuralStunner »

chopkinsca wrote:[wiki]Random[/wiki]
[wiki=DECORATE_expressions]FRandom[/wiki]. :P
User avatar
chopkinsca
Posts: 1325
Joined: Thu Dec 11, 2003 5:03 pm

Re: Camera shake.

Post by chopkinsca »

NeuralStunner wrote:
chopkinsca wrote:[wiki]Random[/wiki]
[wiki=DECORATE_expressions]FRandom[/wiki]. :P
Oh yeah, I always forget about floating point values.
User avatar
bleant
Posts: 224
Joined: Thu Jan 20, 2011 9:37 am

Re: Camera shake.

Post by bleant »

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 :P
User avatar
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.

Post by NeuralStunner »

bleant wrote:And the difference is!? I'm not very good at this, how do i use them?
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:I'm not stupid ok?
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.
User avatar
ChronoSeth
Posts: 1631
Joined: Mon Jul 05, 2010 2:04 pm
Location: British Columbia

Re: Camera shake.

Post by ChronoSeth »

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
User avatar
bleant
Posts: 224
Joined: Thu Jan 20, 2011 9:37 am

Re: Camera shake.

Post by bleant »

Edit: Damnit
lol

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?
User avatar
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.

Post by NeuralStunner »

bleant wrote:Pitch has to do with vertical and angle has to do with horizontal, is that it?
Yep!
User avatar
bleant
Posts: 224
Joined: Thu Jan 20, 2011 9:37 am

Re: Camera shake.

Post by bleant »

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

Post by NeuralStunner »

You can use [wiki]A_SetArg[/wiki] to store the Player's current Pitch and Angle in a couple of their args:

Code: Select all

WOOT A 0 A_SetArg (3, Angle * 1000000)
WOOT A 0 A_SetArg (4, Pitch * 1000000)
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:

Code: Select all

WOOT A 0 A_SetAngle (Args[3] / 1000000.0)
WOOT A 0 A_SetPitch (Args[4] / 1000000.0)
* If anyone knows otherwise, the information would be appreciated.
User avatar
bleant
Posts: 224
Joined: Thu Jan 20, 2011 9:37 am

Re: Camera shake.

Post by bleant »

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 :oops:
User avatar
MG_Man
Posts: 1401
Joined: Sat Jul 28, 2007 1:24 pm
Contact:

Re: Camera shake.

Post by MG_Man »

NeuralStunner wrote:You can use [wiki]A_SetArg[/wiki] to store the Player's current Pitch and Angle in a couple of their args:

Code: Select all

WOOT A 0 A_SetArg (3, Angle * 1000000)
WOOT A 0 A_SetArg (4, Pitch * 1000000)
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:

Code: Select all

WOOT A 0 A_SetAngle (Args[3] / 1000000.0)
WOOT A 0 A_SetPitch (Args[4] / 1000000.0)
* If anyone knows otherwise, the information would be appreciated.
You can use actual variables now, so I don't think you need to deal with args. http://zdoom.org/wiki/A_SetUserVar

Edit: Holy **** we can use arrays in DECORATE too!!
Locked

Return to “Editing (Archive)”