A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Scripting' started by Resilo, Jan 4, 2017.
solved delete thread please
If you ask something and solve it yourself it may be useful for others who google your question. So please rewrite your question (or don't do this next time if you're lazy) and answer it yourself
For anyone else reading this, the original question was how to move a player forward using Vector3.Lerp, using a variable "dashstat" as the modifier.
The original code:
transform.position = Vector3.Lerp(transform.position, forward + new Vector3(0, 0, dashstat), 3.5f);
Rather than declaring "forward + new Vector3" use the transform's position and forward axis to move the character.
"dashstat" should be located in the time section of Vector3.Lerp, and multipled by Time.deltaTime if you are using it to lerp a certain amount over time.
transform.position = Vector3.Lerp(transform.position, transform.position + transform.forward, Time.deltaTime * dashstat);
However, if you want "dashstat" to move a certain distance with a certain speed, you could also multiply the transform.forward. This will increase the increments of which the player moves.
transform.position = Vector3.Lerp(transform.position, transform.position + (transform.forward * dashstat), Time.deltaTime * speedVariable);