- Home /
Unable to override animation by rotating in-game using slider
Hi.. my character is having a glitchy animation after rotating it's spine using slide.. here's my code attached to the spine of my character:
AngleSlider.cs using UnityEngine; using System.Collections;
public class AngleSlider : MonoBehaviour
{
public float speed = 10f;
public Transform playerBoneToMove;
public float rotationX = 0f;
void Start()
{
}
// Update is called once per frame
void LateUpdate()
{
changeBoneOrientation(rotationX);
}
public void AdjustAngle(float newSpeed)
{
Debug.Log("Adjusting...");
speed = newSpeed;
transform.Rotate(speed, 0, 0);
changeBoneOrientation(newSpeed);
}
void changeBoneOrientation(float newRotationX)
{
rotationX = newRotationX;
playerBoneToMove.Rotate(rotationX, 0, 0);
}
}
Here's a video of my game and the animation glitch. Click here to watch the video
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612144150im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Character animation rotates wrong 0 Answers
Animation for turning character around on the spot,Animation for character rotating 0 Answers
Unity Animation Import very slow 4 Answers
Making hands move with weapom 1 Answer
Character rotation on foot? 1 Answer