View Single Post
Re: Yay - Bots move to given vector location...
Old
  (#22)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 11-01-2005

this is what i use:

Code:
Vector vMoveDir;
	Vector vLookDir;
	
	pBot->vLookAtVector = pBot->vMoveToVector; // ITS THE SAME
	vLookDir = pBot->vLookAtVector;	 // look at this
	AngleVectors(AngleWeMoveTo, &vMoveDir); // get movement direction
	
	// move in vMoveDir
	// dot product vMoveDir onto vLookDir to get forward movement
	
	float fForwardDot=DotProduct(vMoveDir, vLookDir); // get the proportion of forwards
	
	Vector vRightLook, vUpLook;
	VectorVectors(vLookDir, vRightLook, vUpLook); // get the vector perpendicular to the forward vector
	
	float fSideDot=DotProduct(vMoveDir, vRightLook); // get the proportion of side
	
	
	cmd.forwardmove=fForwardDot*200.0f;
	cmd.sidemove=fSideDot*200.0f;


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote