![]() |
|
|
#1 |
|
Registered User
Join Date: May. 27th, 2005
Posts: 669
|
Weapon Recoil like on Counter-Strike script?
Ive been working on a weapon and want to add recoil to it. The script I have for the recoil just makes the camera move upwards and I have to move the mouse down endlessly in order to return it to the proper position. What I'm looking for is a way to make the camera go back down to the position where the recoil started to happen just like it does on the Counter-Strike game. Is there a known script for U1 engine that does that already? Or, is this even possible in this engine? And if so, could you please help figure this out by showing a script that would work?
I would really appreciate any help since this is something new to me because Ive never seen it done on any mod. |
|
|
|
|
|
#2 |
|
For the recoil you probably add a certain amount of Pitch to the player's view rotation. How about removing that amount again, but spread across the ticks of, say, the next second.
For example: Code:
var float RecoilLeft;
function ApplyRecoil(int Amount)
{
ApplyRecoilToPlayer(Amount);
RecoilLeft += Amount;
}
function Tick(float DeltaTime)
{
local float RecoilToRemove;
local int ActualRecoil;
RecoilToRemove = FMin(DeltaTime * RecoilLeft, 0);
if (RecoilToRemove == 0)
return;
ApplyRecoilToPlayer(-RecoilToRemove);
RecoilLeft -= RecoilToRemove;
}
__________________
Wormbo's UT/UT2004/UT3 mods | PlanetJailbreak | Unreal Wiki | Liandri Archives Everything you ever wanted to know about replication (but were afraid to ask) [in German] | UnrealScript security considerations <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort <TNSe> nono <TNSe> its always funny to find code a week later you dont even remember writing <Pfhoenix> what's worse is when you have a Star Wars moment <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!" |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|