Need advice on animations
Hi, I am using a set of orientation sensors that give out Euler angles and quaternions. I am updating the arm rotations according to those values. I'm using the slerp method but the movement is not smooth. I can't update movement in the update method as it would never stop. What should I use instead?
Answer by Cuttlas-U · Apr 14, 2017 at 07:18 PM
hi; the title u said u need advice on animations;
then u asked about movement is not smooth with slerp;
and at the end u said u cant use movement in the update;
so i dont know exactly your problem ;
pls explain more and provide your script tnx;
public void readQuat1(string message)
{
// Convert the hex to coordinates
String[] splitValues = msg.Split('-');
String hexY = splitValues[3] + splitValues[2];
String hexX = splitValues[5] + splitValues[4];
String hexZ = splitValues[7] + splitValues[6];
int y = (short)Int32.Parse(hexY, System.Globalization.NumberStyles.HexNumber);
int x = (short)Int16.Parse(hexX, System.Globalization.NumberStyles.HexNumber);
int z = (short)Int16.Parse(hexZ, System.Globalization.NumberStyles.HexNumber);
upperArm.rotation = Quaternion.Slerp (upperArm.rotation, Quaternion.Euler (x, y, z), Time.deltaTime);
}
This is the code for reading the values from the sensor. On android side I'm just calling these functions using UnitySend$$anonymous$$essage().
If I call this function in update the arm movement is very smooth but I can't call it in update.
Your answer
Follow this Question
Related Questions
unwanted rotation in y axis 0 Answers
Substitute transform.rotation + slerp with transform.rotate and Vector3 0 Answers
Transform.rotate with small angles jumps from 180 to 90 0 Answers
How to Slerp / Lerp Rotation on a Single Axis? 0 Answers
Rotate the point around the normal from two points (flip point) 2 Answers