Help❓ Spread Crosshair

Posts 1–7 of 7 · Page 1 of 1
❓ Spread Crosshair
I'd like to make a simple circle crosshair that expands by the spread/inaccuracy of the weapon. How would I make this possible? How would I calculate the radius of the circle?

Any help is appreciated
Think about how the most basic norecoil works.
You remove 2 times the punch angle from your viewangles.

Do the opposite and you'll have a rough position of where the bullets will be going
Just make the sizing of the drawcircle based on the spread amout.

Please no one spoonfeed him sources.
So, a little update. I managed to get one working its not the best but it works to my standards. But. It crashes after a few minutes of using it
Code:
	RECT View = Draw::Viewport();
	int x = View.right / 2;
	int y = View.bottom / 2;
	float inac = pWeapon->GetInaccuracy();
	float radius = inac * 500;
	Draw::Circle(x, y, spread, 50, Color(255, 0, 0, 255));
I attached a debugger and it crashes on VTablePointer.

Code:
template< typename Function > Function call_index(PVOID Base, DWORD Index)
{
	PDWORD* VTablePointer = (PDWORD*)Base;
	PDWORD VTableFunctionBase = *VTablePointer; //crashes here
	DWORD Address = VTableFunctionBase[Index];
	return (Function)(Address );
}
GetInaccuracy
Code:
	float GetInaccuracy()
	{
		typedef float(__thiscall* oInaccuracy)(PVOID);
		return call_index< oInaccuracy >(this, 483)(this);
	}
Again, help would be nice
if (!this) return 0.f; should do the job
- - - Updated - - -

Quote Originally Posted by certmemer View Post
if (!this) return 0.f; should do the job
worked! +1 Thanks
Quote Originally Posted by zahk59869 View Post
- - - Updated - - -


worked! +1 Thanks
float spread = ((getinaccuracy() + getspreadcone()) * 320.f) / std::tan(deg2rad(v.vis.fov) * 0.5f) * screenheight / 480.f;
thats supposedly a perfect one, v.vis.fov being your current fov, cant provide a spreadcone index though, gl
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us