Raised This Month: $404 Target: $400
 101% 

[TF2/L4D*/?] [SNIPPET] Smoothly turning players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 10-06-2018 , 14:20   [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #1

I've found that view punch works really well with rotating the player because of its instant effect and smoothing towards the actual player view.

Applying it in the other direction, on the same frame, produces smooth turning effect with a little bit of wobbling at the end if the angle is wide enough. This only works in first person, other players just see the client spazzing about.

PHP Code:
stock void RotateClientSmooth(int clientfloat fAngle){
    
float fPunch[3], fEyeAng[3];
    
GetClientEyeAngles(clientfEyeAng);

    
fEyeAng[1] -= fAngle;
    
fPunch[1] += fAngle;

    
TeleportEntity(clientNULL_VECTORfEyeAngNULL_VECTOR);
    
SetEntPropVector(clientProp_Send"m_vecPunchAngle"fPunch);

PHP Code:
RotateClientSmooth(client30.0); // turns client 30 degrees to right 
I don't know if m_vecPunchAngle is available for mods other than TF2.

Last edited by Phil25; 10-07-2018 at 00:58.
Phil25 is offline
Crasher_3637
AlliedModders Donor
Join Date: May 2012
Old 10-06-2018 , 15:13   Re: [TF2/?] [SNIPPET] Smoothly turning players
Reply With Quote #2

That netprop is available for L4D/L4D2 as well, so this stock will work for the L4D series.



Thanks btw!

Edit: This may be off-topic but I found that out by using your code for the Strong Recoil perk from your RTD plugin in a test plugin, which I tested in both L4D games.
__________________
AFK like JFK

Last edited by Crasher_3637; 10-06-2018 at 15:16.
Crasher_3637 is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 10-07-2018 , 01:08   Re: [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #3

Very nice to hear it works in other mods! I imagine if the netprop was already present in OB, it has to be present in every Source game because of its broad usage, but can't be bothered to check. :p

Speaking of RTD, that method is used in the upcoming perk Drunk Walk, I bet that can be ported to L4D as well then.
Phil25 is offline
Crasher_3637
AlliedModders Donor
Join Date: May 2012
Old 10-07-2018 , 03:26   Re: [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #4

Quote:
Originally Posted by Phil25 View Post
Very nice to hear it works in other mods! I imagine if the netprop was already present in OB, it has to be present in every Source game because of its broad usage, but can't be bothered to check. :p

Speaking of RTD, that method is used in the upcoming perk Drunk Walk, I bet that can be ported to L4D as well then.
Yeah I just tried the stock in L4D2 and it works just fine. I was wondering if there's a way to increase the speed, because I have this idea to make the player spin around really fast so they can't aim. (I can be evil too )
__________________
AFK like JFK
Crasher_3637 is offline
ThatKidWhoGames
Senior Member
Join Date: Jun 2013
Location: IsValidClient()
Old 10-09-2018 , 08:32   Re: [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #5

Thanks for this!!
__________________


I take custom plugin requests, add me on Steam for details.
ThatKidWhoGames is offline
404UNF
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Location: 🍁
Old 10-16-2018 , 15:50   Re: [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #6

Did....did Phil reply to himself as if he was a completely different person? Or is there a deleted post that I didn't see in between his two posts?
__________________
I'm not a SourcePawn expert, I just play one on TV.
Want to join the SourceMod Discord server? Click here!

404UNF is offline
Crasher_3637
AlliedModders Donor
Join Date: May 2012
Old 10-16-2018 , 15:58   Re: [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #7

Quote:
Originally Posted by 404UNF View Post
Did....did Phil reply to himself as if he was a completely different person? Or is there a deleted post that I didn't see in between his two posts?
He replied to me, and no I didn't delete my post.
__________________
AFK like JFK
Crasher_3637 is offline
404UNF
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Location: 🍁
Old 10-16-2018 , 19:22   Re: [TF2/L4D*/?] [SNIPPET] Smoothly turning players
Reply With Quote #8

Quote:
Originally Posted by Crasher_3637 View Post
He replied to me, and no I didn't delete my post.
That is weird because I didn't see the post on my lapt-...oh. I must've blocked an element of the forums with uBlock Origin which also affects the 1st reply of a thread being visible. Shit.

IGNORE ME!!!
__________________
I'm not a SourcePawn expert, I just play one on TV.
Want to join the SourceMod Discord server? Click here!


Last edited by 404UNF; 10-16-2018 at 19:23.
404UNF is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:42.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode