Moving the player view - Weapon muzzle climb / recoil.
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Moving the player view - Weapon muzzle climb / recoil.
I've been working on a mod for my own amusement, and to add some skill I wanted to have some of the weapons cause the view to move up each time the weapon was fired. The idea was to balance some of the more powerful automatic weapons I have added. It seemed easy, and the solution is, however I could not find it easily. It took probably 5 hours of experimenting, and searching, to finally figure out how to do it.
And no, self.punchangle does not create this effect; I wanted the actual aim point to climb each time the weapon was fired.
I ended up with this function that directly writes to the server to move the view.
Used like this after the weapon fires:
I thought it might be useful for someone trying to figure out how to make this work. It drove me nuts. Also, if someone knows a better way to do it, that would be great to know as well.
And no, self.punchangle does not create this effect; I wanted the actual aim point to climb each time the weapon was fired.
I ended up with this function that directly writes to the server to move the view.
- Code: Select all
void(float vkick) WeaponRecoil =
{
msg_entity = self;
WriteByte(MSG_ONE, 10);
WriteAngle(MSG_ONE, self.v_angle_x - vkick);
WriteAngle(MSG_ONE, self.v_angle_y);
WriteAngle(MSG_ONE, self.v_angle_z);
};
Used like this after the weapon fires:
- Code: Select all
Fire_Weapon();
WeaponRecoil(4);
I thought it might be useful for someone trying to figure out how to make this work. It drove me nuts. Also, if someone knows a better way to do it, that would be great to know as well.
- Ace12GA
- Posts: 56
- Joined: Sat Jan 28, 2012 12:08 am
Re: Moving the player view - Weapon muzzle climb / recoil.
you can force the player's viewpoint to snap to player.angle by setting player.fixangle to 1 as well. 
- necros
- Posts: 77
- Joined: Thu Dec 16, 2004 10:32 pm
Re: Moving the player view - Weapon muzzle climb / recoil.
very handy! punchangle is all i ever knew, but i did know it didnt move the v_angle literally, but i used it anyways for the effect. 
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest