- Home /
How to have a character climb an obsticle automatically?
Hey, so I'm making a thirdperson game in which my character is able to climb an height obsticle just by moving into it. This should kinda work similary liking scaling obstacles in mirrors edge or a parkour game. I already have downloaded some animations from MIXAMO but i dont know how to go about doing it. Anyhere here's my animation script:
![using UnityEngine;
using System.Collections;
public class ExoCtrlScript : MonoBehaviour {
private Animator ExoThysius;
// Use this for initialization
void Start() {
ExoThysius = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
ExoThysius.SetFloat("Vspeed", Input.GetAxis("Vertical"));
ExoThysius.SetFloat("Hspeed", Input.GetAxis("Horizontal"));
// TURNING
if (Input.GetAxis("Horizontal")!=0)
{
ExoThysius.SetBool("Turning", true);
if (Input.GetAxis("Horizontal") > 0)
{
transform.Rotate(Vector3.up * Time.deltaTime * 100.0f);
}
//turn left
if (Input.GetAxis("Horizontal") < 0)
{
transform.Rotate(Vector3.down * Time.deltaTime * 100.0f);
} //turn right
}
else
{
ExoThysius.SetBool("Turning", false);
}
if (Input.GetAxis("Vertical") != 0 && (Input.GetAxis("Horizontal")) > 0) // running and turning left
{
transform.Rotate(Vector3.up * Time.deltaTime * 100.0f);
ExoThysius.SetBool("Turning", true);
}
if (Input.GetAxis("Vertical") != 0 && (Input.GetAxis("Horizontal")) < 0) // running and turning right
{
transform.Rotate(Vector3.down * Time.deltaTime * 100.0f);
ExoThysius.SetBool("Turning", true);
}
if (Input.GetButtonDown("Jump"))
{
ExoThysius.SetBool("Jumping", true);
Invoke("StopJumping", 0.1f);
}
}
void StopJumping()
{
ExoThysius.SetBool("Jumping", false);
}
}][1]
[1]: /storage/temp/72044-scene2.png
Answer by Abhiroop-Tandon · Jun 13, 2016 at 08:45 AM
The way i will deal with your problem will be to already have an animation of the player climbing the top of the obstacle, have a trigger near the obstacle and play the animation when you hit the trigger. I hope i make sense !!
Answer by AnimationBandit · Sep 11, 2016 at 04:37 AM
You may find this animation pack helpful for developing your climbing system. It contains a 360 degree blended array of animation for climbing in any direction, as well as many other ledge and parkour actions.
Link to asset: http://u3d.as/xui
Answer by jonnytracker · Jun 23, 2020 at 09:30 PM
.. mixamo root motion is hip... Unity expect root bone to be on ground So i have a problem too with the same subject in 2020 .
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
using sample assets beta, how to add animation to the third person character? 1 Answer
Character teleporting back to origin point when using looped animations 1 Answer
How to animate for object interaction? 1 Answer
What's better to do sprinting and parkour animations in, unity 3d or blender? 2 Answers