Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Reply
 
Thread Tools Display Modes
Old 06-04-2012, 03:36 PM   #1
herbius
 
 
 
Join Date: Dec 2007
Reputation: 132
Posts: 618
Ironsight tutorial - model "jumps" on release of ironsights

I've been following the Wiki's ironsighting tutorial at https://developer.valvesoftware.com/wiki/Ironsights and it's all worked well, but I noticed that it caused the weapon not to do the usual drift when the view is rotated. To eliminate this (but to keep the non-drift while in ironsighted mode, so that the see-through side of the viewmodel doesn't drift in front of the view) I checked whether m_expFactor was 0 (ie. the weapon was not ironsighted) before calling CalcViewModelLag. That seemed to work but when m_expFactor then reaches 0, the weapon model pings off and then drifts back to the neutral positon. The scale of the ping seems to depend on the difference between the view angles of the player when the ironsighting was applied and removed. Is there a graceful way around this?
herbius is offline  
Reply With Quote
Old 06-15-2012, 12:34 AM   #2
MilkywayM16
 
Join Date: Sep 2010
Reputation: 0
Posts: 51
Quote:
Originally Posted by herbius View Post
I've been following the Wiki's ironsighting tutorial at https://developer.valvesoftware.com/wiki/Ironsights and it's all worked well, but I noticed that it caused the weapon not to do the usual drift when the view is rotated. To eliminate this (but to keep the non-drift while in ironsighted mode, so that the see-through side of the viewmodel doesn't drift in front of the view) I checked whether m_expFactor was 0 (ie. the weapon was not ironsighted) before calling CalcViewModelLag. That seemed to work but when m_expFactor then reaches 0, the weapon model pings off and then drifts back to the neutral positon. The scale of the ping seems to depend on the difference between the view angles of the player when the ironsighting was applied and removed. Is there a graceful way around this?
If you're talking about what I'm assuming, then there are a few ways around this. One way would be to disable the weapon lag altogether. This is the easiest and quickest solution.

Another way would be to try and make a duplicate function of the calcviewmodellag, name it something else, give the lag variables a much smaller value, and only call it when ironsighted.

It would be a simple if else statement telling the game to call the duplicate weapon lag function only when ironsighted and call the regular one any other time. This would hopefully prevent that jumping since the model lag isn't going from an "off" to "on" state change which causes the jump in the first place. It would instead go from a smaller lag to a larger lag. I haven't tried this myself but it's worth a shot.
MilkywayM16 is offline   Reply With Quote
Old 06-15-2012, 05:37 AM   #3
herbius
 
 
 
Join Date: Dec 2007
Reputation: 132
Posts: 618
OK, thanks.
herbius is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding


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



All times are GMT -7. The time now is 07:26 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.