|
|
#1 |
|
Guest
Posts: n/a
|
Make the bullet shoot at the crosshair??
This is for my third person over the shoulder mod.
Basically i want the bullet to hit at where the crosshair is and only were the crosshair is. I found Vector CBasePlayer::Weapon_ShootPosition( ) But I am clueless I have spent a few hours wondering around and got no where. How would I go about making the bullet hit where the crosshair is? Please don't go off topic! |
|
|
|
#2 |
![]() Join Date: Jul 2007
Reputation: 84
Posts: 2,170
|
Shoot position is where the bullet starts iat. You want to affect the angle its fired at, which iirc is specified in each weapon's primary attack function
|
|
|
|
|
|
#3 | |
|
Guest
Posts: n/a
|
Quote:
Code:
pPlayer->entindex(), pPlayer->Weapon_ShootPosition(), pPlayer->EyeAngles() + pPlayer->GetPunchAngle(), Any Help? It's probably staring at me right in the face. And yes I did look at Code:
void CHudCrosshair::Paint( void )
{
if ( !m_pCrosshair )
return;
if ( !IsCurrentViewAccessAllowed() )
return;
m_curViewAngles = CurrentViewAngles();
m_curViewOrigin = CurrentViewOrigin();
float x, y;
x = ScreenWidth()/2;
y = ScreenHeight()/2;
// MattB - m_vecCrossHairOffsetAngle is the autoaim angle.
// if we're not using autoaim, just draw in the middle of the
// screen
if ( m_vecCrossHairOffsetAngle != vec3_angle )
{
QAngle angles;
Vector forward;
Vector point, screen;
// this code is wrong
angles = m_curViewAngles + m_vecCrossHairOffsetAngle;
AngleVectors( angles, &forward );
VectorAdd( m_curViewOrigin, forward, point );
ScreenTransform( point, screen );
x += 0.5f * screen[0] * ScreenWidth() + 0.5f;
y += 0.5f * screen[1] * ScreenHeight() + 0.5f;
}
m_pCrosshair->DrawSelf(
x - 0.5f * m_pCrosshair->Width(),
y - 0.5f * m_pCrosshair->Height(),
m_clrCrosshair );
}
Last edited by FeareD: 03-27-2009 at 05:47 PM. |
|
|
|
|
#4 |
![]() Join Date: May 2008
Reputation: 169
Posts: 5,362
|
You could either re-position the crosshair by shooting a traceline and putting it at the end, or you'll have to use some trigonometry where the shooting-angles are determined as you've probably re-positioned and rotated the camera.
|
|
|
|
|
|
#5 | |
|
Guest
Posts: n/a
|
Quote:
P.S it shouldn't be hard! I should be able to just put some offsets in to center it right in the middle of the screen! Last edited by FeareD: 03-27-2009 at 06:13 PM. |
|
|
|
|
#6 |
![]() Join Date: May 2008
Reputation: 169
Posts: 5,362
|
Did you align it with the eyeangles or really shot a traceline? Because the fix (or whatever you wanna call it) on VALVe's wiki suggests using a traceline.
|
|
|
|
|
|
#7 |
|
Guest
Posts: n/a
|
|
|
|
|
#10 |
![]() Join Date: May 2008
Reputation: 169
Posts: 5,362
|
You could store the old crosshair-position and interpolate like this (always only adding a maximum-clamped value), but of course the aim would be a bit delayed; so depending on how well this would work you have to do some trig in the shooting-angle.
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|