- Home /
Question by
thevraptor · Apr 17, 2014 at 02:27 AM ·
lerptransform.translate
Vector3.Lerp with Translate Javascript
Hello.
I am making a walljump script in which if the raycast is true and the spacebar is pressed, the player is moved backards in the manner of a walljump. I am trying to make it as smooth as possible, hence why there is Time.deltaTimes everywhere. I want to use a lerp, but don't know how to do that with a translate. Thanks.
var walljumpHeight : int = 30;
var walljumpLength : int = -50;
var raycastLength : int = 1;
function Start () {
}
function Update () {
var fwd = transform.TransformDirection (Vector3.forward);
if (Physics.Raycast (transform.position, fwd, raycastLength) && Input.GetButton ("Jump") ) {
transform.Translate(0, walljumpHeight * Time.deltaTime, walljumpLength * Time.deltaTime);
}
}
Comment
Please format your code, by either using the 101010
button or indenting it by four spaces.
Your answer
![](https://koobas.hobune.stream/wayback/20220613142915im_/https://answers.unity.com/themes/thub/images/avi.jpg)