cheese and crackers

Published February 20, 2005
Advertisement
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;}
Previous Entry ...
Next Entry good morning folks
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Not bad.

1146 views

Zoned out.

1021 views

more

1101 views

Slow down champ.

917 views

I'll be back

880 views

Busy.

1036 views

oh teh noes!!

923 views
Advertisement