Thanks for the advice I re-checked the original camera code for third person, and noticed that it didn't turn off third person shoulder view, and it didn't restore the camera distance, so I modified it like this :
void CInput::CAM_ToThirdPerson(void) > { > ASSERT_LOCAL_PLAYER_RESOLVABLE(); > PerUserInput_t &user = GetPerUser(); > QAngle viewangles; > > engine->GetViewAngles( viewangles ); > > //if( !user.m_fCameraInThirdPerson ) > //{ > user.m_fCameraInThirdPerson = true; > c_thirdpersonshoulder.SetValue( false ); > cam_idealdist.SetValue( cam_idealdist.GetDefault() ); > > user.m_vecCameraOffset[ YAW ] = viewangles[ YAW ]; > user.m_vecCameraOffset[ PITCH ] = viewangles[ PITCH ]; > user.m_vecCameraOffset[ DIST ] = CAM_MIN_DIST; > //} > > user.m_nCamCommand = 0; > } > and now it works perfectly :) thanks ! On Fri, Sep 9, 2011 at 7:52 AM, Jan Hartung <jan.hart...@gmx.de> wrote: > I had to implement a first person/third person switch for our mod as well > (using Source 2007) and I also ran into problems with the camera not > switching to the mode I wanted it to.**** > > Ultimately I had to edit CAM_ToFirstPerson() and CAM_ToThirdPerson() to > remove some checks (for example the sv_cheats check) which prevented the > camera from switching around its mode. Maybe this points to the solution > somehow.**** > > ** ** > > Jan**** > > ** ** > > *Von:* hlcoders-boun...@list.valvesoftware.com [mailto: > hlcoders-boun...@list.valvesoftware.com] *Im Auftrag von *Psy_Commando > *Gesendet:* Freitag, 9. September 2011 02:02 > *An:* Discussion of Half-Life Programming > *Betreff:* Re: [hlcoders] Switch from third person to third person > shoulder**** > > ** ** > > Thanks, but it only slightly helped :) > For some reasons the camera doesn't changes back when I release the mouse > button. I checked and StopAiming actually gets called, but it seems that > CAM_ToThirdPerson doesn't do anything :(**** > > On Thu, Sep 8, 2011 at 3:23 PM, Igoreso <igor...@inbox.ru> wrote:**** > > My guess would be to remove**** > > if( m_SFRLocal.m_bAiming )**** > > or replace it with something else. > Everything else seem ok.**** > > > > Hi, I'm trying to have the camera switch from third person to third > > person shoulder when the user holds the right mouse button. here are > > my methods on the client and server : > > > Shared: > > int buttonsChanged = m_afButtonPressed | m_afButtonReleased; > > > if( buttonsChanged & IN_ZOOM ) > > { > > if( m_nButtons & IN_ZOOM ) > > { > > StartAiming(); > > } > > else if( m_SFRLocal.m_bAiming ) > > { > > StopAiming(); > > m_nButtons &= ~IN_ZOOM; > > } > > } > > > Client: > > void C_ASW_Player::StartAiming() > > { > > ASWInput()->CAM_ToThirdPersonShoulder(); > > m_SFRLocal.m_fTimeNextAim = gpGlobals->curtime + 0.5f; > > } > > > void C_ASW_Player::StopAiming() > > { > > ASWInput()->CAM_ToThirdPerson(); > > m_SFRLocal.m_fTimeNextAim = gpGlobals->curtime + 0.1f; > > } > > > > Server: > > > void CASW_Player::StartAiming() > > { > > StartWalking(); > > m_SFRLocal.m_bAiming = true; //local player data > > m_SFRLocal.m_fTimeNextAim = gpGlobals->curtime + 0.5f; > > } > > > void CASW_Player::StopAiming() > > { > > StopWalking(); > > m_SFRLocal.m_bAiming = false; //local player data > > m_SFRLocal.m_fTimeNextAim = gpGlobals->curtime + 0.1f; > > } > > > > > For some reasons the camera doesn't behave correctly and stays > > stuck in either third person or third person shoulder... > > **** > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders**** > > ** ** > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > >
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders