View Single Post
  #155  
Old 06-08-2016, 04:19 AM
Tyen05
Discordant
 
Join Date: Mar 2009
Location: eqbrowser.com
Posts: 309
Default

If you fall underneath world, it'll toss you to safe spot. Also tossed some more pathing stuff for debug purposes. Bunch of other stuff not listed, but this was kinda neat.

My step distance (currently set to 1) is wrong. So the wandering speed/steps in between the two points is not correct.

https://youtu.be/WpsF61JyttM

Code:
Vector3 targetPosition = new Vector3 (movetoX,movetoY,movetoZ);
Vector3 deltaF = new Vector3 (deltaX,deltaY,deltaZ);

if (deltaF.magnitude != 0) 
	{
		//step = delta time x speed. The server is calculating the speed which is represented as the magnitude of vector x y z. Translate the game object by those deltas multiplied by delta time	
		float step = deltaF.magnitude * Time.deltaTime;
		transform.position = Vector3.MoveTowards(this.gameObject.transform.position, targetPosition, 1);

		Debug.DrawRay (this.gameObject.transform.position, (targetPosition - this.gameObject.transform.position), Color.green);
	}
__________________
Browser based EQ project
Reply With Quote