Question by
Detinator10 · Jan 31, 2016 at 09:41 PM ·
rotationmovement scriptforward
Wall-Running using triggers
I am using this code to do my WAll-running, it works great, but only along the left side of a wall and only if the y-rotation = 360. I assume I have to do something with local forwards or something idk. And yes the character is supposed to stay on the wall forever like spiderman (no slow pull down like in many games). So, how do I get this to work at all angles of wall, I basically want to get the forward direction of the wall or something so that I walk parallel to the wall no matter what orientation the wall is at..
void WallRunRL(){
forwardspeed = Input.GetAxis ("Vertical");
sidespeed = Input.GetAxis ("Horizontal");
if (WallRunningRight) {
speed = new Vector3 (0, sidespeed * speedmult * speedmultfactor, -forwardspeed * speedmult * speedmultfactor);
} else {
speed = new Vector3 (0, -sidespeed * speedmult * speedmultfactor, forwardspeed * speedmult * speedmultfactor);
}
//speed = transform.rotation * speed;
CharCon.Move (speed * Time.deltaTime);
}
Comment
Your answer
Follow this Question
Related Questions
Character Rotation 0 Answers
Rotating a forward vector 0 Answers
Changing the direction of movement 0 Answers
Cube turns in moving direction, but always returns to default direction 0 Answers