• entries
72
38
• views
22401

cheese and crackers

221 views

Well, I bought Half-Life 2 yesterday. Mostly for the Counter Strike 'mod' that is included. If its bundled with the software, I dont really consider it a mod, but you get it. I play as hatekick, phear me. ;) Naw, I still suck.

Long story short, I'm still a shitty coder I guess. I need to rewrite a function that is dependant on a class being pased as an argument. It solves t for sphere to plane collision. Some of the first attempt code is commented out.
float	CColSphere::CollideAABB(const CColAABB &s, float tcount){	Vector3 S = Internal;	Vector3 D = Direction * Velocity * tcount;	Vector3 P = s.Internal + s.ClosestToPoint(S - s.Internal);	Vector3 C = S - P;	Vector3 N = Normalize3( C );	//Vector3 R = S + ( N * -Radius );	float d = ( C * N ) - Radius;	float u = ( d - ( C * N ) + Radius );	float f = ( D * N );	//float f = N * ( Direction * Velocity * tcount );	//float u = ( R - C ) * N;	float t = u / f;	if(t <= 0.0f)	{		Vector3 b = s.ClosestToPoint(Internal - s.Internal);		Vector3 c = (Internal - (b + s.Internal));		//		if(c.x)			Direction.x = -Direction.x;		if(c.z)			Direction.z = -Direction.z;		if(c.x && c.z)			Direction = c;		if( s.Contains( Internal - s.Internal ) )			Direction = Internal - s.Internal;		Direction = Normalize3(Direction);		return 1.0f;	}	if(t < 1.0f && t > 0.0f)		return t;	else		return 0.0f;}

There are no comments to display.

Create an account

Register a new account