- Home /
How to Fix Compilier Errors?
How do I fix global compilier errors so I can go into playmode?
using UnityEngine; using System.Collections; using System.Collections.Generic;
[System.Serializable] public class LegInfo { public Transform hip; public Transform ankle; public Transform toe; public float footWidth; public float footLength; public Vector2 footOffset; [HideInInspector] public Transform[] globallegChain; [HideInInspector] public Transform[] footChain; [HideInInspector] public float legLength; [HideInInspector] public Vector3 ankleHeelVector; [HideInInspector] public Vector3 toeToetipVector; [HideInInspector] public Color debugColor; }
[System.Serializable] public class MotionGroupInfo { public string name; public IMotionAnalyzer[] motions; public Interpolator interpolator; public float[] GetMotionWeights(Vector3 velocity) { return interpolator.Interpolate(new float[] {velocity.x, velocity.y, velocity.z}); } }
[System.Serializable] public class LegControllerglobal : MonoBehaviour { public float groundPlaneHeight; public AnimationClip groundedPose; /[HideInInspector]/ public Transform rootBone; public Transform root { get { return rootBone; } } public LegInfo[] legs; public MotionAnalyzer[] sourceAnimations; [HideInInspector] public bool initialized = false; [HideInInspector] public MotionAnalyzerBackwards[] sourceAnimationsBackwards; [HideInInspector] public Vector3 m_HipAverage; public Vector3 hipAverage { get { return m_HipAverage; } } [HideInInspector] public Vector3 m_HipAverageGround; public Vector3 hipAverageGround { get { return m_HipAverageGround; } } [HideInInspector] public IMotionAnalyzer[] m_Motions; public IMotionAnalyzer[] motions { get { return m_Motions; } } [HideInInspector] public IMotionAnalyzer[] m_CycleMotions; public IMotionAnalyzer[] cycleMotions { get { return m_CycleMotions; } } [HideInInspector] public MotionGroupInfo[] m_MotionGroups; public MotionGroupInfo[] motionGroups { get { return m_MotionGroups; } } [HideInInspector] public IMotionAnalyzer[] m_NonGroupMotions; public IMotionAnalyzer[] nonGroupMotions { get { return m_NonGroupMotions; }} public void InitFootData(int leg) { // Make sure character is in grounded pose before analyzing gameObject.SampleAnimation(groundedPose,0); // Give each leg a color Vector3 colorVect = Quaternion.AngleAxis(leg*360.0f/legs.Length, Vector3.one) Vector3.right; legs[leg].debugColor = new Color(colorVect.x, colorVect.y, colorVect.z); // Calculate heel and toetip positions and alignments // (The vector from the ankle to the ankle projected onto the ground at the stance pose // in local coordinates relative to the ankle transform. // This essentially is the ankle moved to the bottom of the foot, approximating the heel.) // Get ankle position projected down onto the ground Matrix4x4 ankleMatrix = Util.RelativeMatrix(legs[leg].ankle,gameObject.transform); Vector3 anklePosition = ankleMatrix.MultiplyPoint(Vector3.zero); Vector3 heelPosition = anklePosition; heelPosition.y = groundPlaneHeight; // Get toe position projected down onto the ground Matrix4x4 toeMatrix = Util.RelativeMatrix(legs[leg].toe,gameObject.transform); Vector3 toePosition = toeMatrix.MultiplyPoint(Vector3.zero); Vector3 toetipPosition = toePosition; toetipPosition.y = groundPlaneHeight; // Calculate foot middle and vector Vector3 footMiddle = (heelPosition + toetipPosition)/2; Vector3 footVector; if (toePosition==anklePosition) { footVector = ankleMatrix.MultiplyVector(legs[leg].ankle.localPosition); footVector.y = 0; footVector = footVector.normalized; } else { footVector = (toetipPosition - heelPosition).normalized; } Vector3 footSideVector = Vector3.Cross(Vector3.up, footVector); legs[leg].ankleHeelVector = ( footMiddle + (-legs[leg].footLength/2 + legs[leg].footOffset.y) footVector + legs[leg].footOffset.x footSideVector ); legs[leg].ankleHeelVector = ankleMatrix.inverse.MultiplyVector(legs[leg].ankleHeelVector - anklePosition); legs[leg].toeToetipVector = ( footMiddle + (legs[leg].footLength/2 + legs[leg].footOffset.y) footVector + legs[leg].footOffset.x footSideVector ); legs[leg].toeToetipVector = toeMatrix.inverse.MultiplyVector(legs[leg].toeToetipVector - toePosition); } public void Init() { // Only set initialized to true in the end, when we know that no errors have occurred. initialized = false; Debug.Log("Initializing "+name+" Locomotion System..."); // Find the skeleton root (child of the GameObject) if none has been set already if (rootBone==null) { if (legs[0].hip==null) { Debug.LogError(name+": Leg Transforms are null.",this); return; } rootBone = legs[0].hip; while (root.parent != transform) rootBone = root.parent; } // Calculate data for LegInfo objects m_HipAverage = Vector3.zero; for (int leg=0; leg sourceAnimationBackwardsList = new List(); for (int i=0; i motionGroupNameList = new List(); List motionGroupList = new List(); List> motionGroupMotionLists = new List>(); List nonGroupMotionList = new List(); for (int i=0; i()); } motionGroupMotionLists[motionGroupNameList.IndexOf(groupName)].Add(motions[i]); } } m_NonGroupMotions = nonGroupMotionList.ToArray(); m_MotionGroups = motionGroupList.ToArray(); for (int g=0; g0.5f) aChange = aChange-1; if (bChange>0.5f) bChange = bChange-1; offsetChanges[i] += aChange 5.0f / springs; offsetChanges[j] += bChange * 5.0f / springs; } } } // Apply new offset changes float maxChange = 0; for (int i=0; i
Where have you found this script? There are many parts missing! You could edit the question and paste the code again - but this time leave a blank line between the text and the code, then select the code and press Ctrl-$$anonymous$$ to format it
Sorry I'm not a compiler. What is the error message? Which line?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Out of Range Exception 1 Answer
not compiling for android 2 Answers
(FIXED)Unity never stops crashing... help ASAP 2 Answers
NullReferenceExeption: Object reference not set to an instance of an object. 1 Answer