Sign in to follow this  

Planar reflection with skid factor

Recommended Posts

Hi guys. I have a working vector reflection member of my plane class as below. I want to extend it so that it takes a "skid factor" as an optional argument. When the skid is 1, you get a perfect reflection. When it is 0, I want the reflection to be the parallel component of the plane, ie skidding flatly along it. Obviously non-zero values will lerp between the two extremes ? Can anyone show me how to do this, because my math sucks and I've been stuck on this for ages. Many thanks in advance...
tBOOL	CPlane::Reflect (CVector3 Dir,CVector3 &OutDir)
tF32		Dot;
CVector3	VPar;

	if (Dot > 0)
	  return FALSE;



	return TRUE;


Share this post

Link to post
Share on other sites
I'm assuming what you want is a function that takes a vector and outputs a vector that has been reflected around the normal of the plane and modified by some skid factor? From what it seems like your "skid factor" is, my equation would look something like this:

OutDir = Dir - (1 + skid_factor)*Normal*DotProduct(Dir, Normal);

Therefore, when skid_factor is 0, you'll get a line perpendicular to the plane normal (and therefore on parallel to the plane), and when skid_factor is 1 you'll get the perfect reflection.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this