Hi I’m making a parkour game and I would like to know how could I make the wall run more in a curve, have a scheme of what I mean and what I want:
I think the scheme is understandable, I think to do that curved movement I need to use Mathf.Clamp, I don’t remeber but I think it was that, I have some videos on my youtube channel of the current gameplay, but in those I actually did no full wallrun so you could see what I mean. Also I give you my script, it’s using triggers to detect walls by the way, from the script you can see that it would obviously not make a curve, so can anyone tell me waht I need to add to make it do a curve? I will probably ahve to remake most of the script right?
#pragma strict
var mainPlayer : GameObject;
var timer : float = 4;
var mainPlayerVars : PlayerMovementScript;
function Start () {
}
function Update ()
{
}
function OnTriggerEnter ()
{
}
function OnTriggerExit ()
{
mainPlayer.rigidbody.useGravity = true;
timer = 4;
}
function OnTriggerStay ()
{
if(Input.GetButton("Jump")){
timer -= Time.deltaTime;
mainPlayer.rigidbody.useGravity = false;}
else{
mainPlayer.rigidbody.useGravity = true;}
if(timer >=3 && Input.GetButton("Jump"))
mainPlayer.rigidbody.transform.Translate(0,0.15*Time.deltaTime,0.3*Time.deltaTime);
if(timer < 3 && Input.GetButton("Jump"))
mainPlayer.rigidbody.useGravity = true;
if(Input.GetButtonUp("Jump")){
mainPlayer.rigidbody.AddRelativeForce(Vector3.right * 8000 * Time.deltaTime);
mainPlayer.rigidbody.AddForce(Vector3.up * 4000 * Time.deltaTime);}
if (mainPlayerVars.grounded)
timer = 4;
}
another thing is that I heard that transform.translate ignores physics, maybe that could be bad for a parkour game, i don’t know, tell me what you think. (The character is a rigidbody).
thanks in advance, hope you can understand what I want. EDIT: I think it’s Mathf.Lerp, but I don’t know if I can use Mathf.Lerp with 3 points