Joint that restricts the motion of a Rigidbody2D object to a single line.

Inheritance: AnchoredJoint2D
Example #1
1
    void Start()
    {
        // Reparent to root container
        transform.parent = transform.rootParent();

        // Create a slider joint from startLimit to endLimit

        if (!parentBody)
        {
            rootObject = new GameObject("SliderRoot");
            rootObject.transform.position = startLimit.transform.position;
            parentBody = rootObject.AddComponent<Rigidbody2D>();
            parentBody.isKinematic = true;
        }

        sliderJoint = parentBody.gameObject.AddComponent<SliderJoint2D>();

        JointTranslationLimits2D limits = sliderJoint.limits;

        // min is roughly distance from parentBody to startLimit...
        limits.min = Vector2.Distance(parentBody.transform.position, startLimit.position);
        limits.max = Vector2.Distance(startLimit.position, endLimit.position) + limits.min;

        sliderJoint.limits = limits;

        sliderJoint.angle = Quaternion.FromToRotation(Vector3.right,
                endLimit.position - startLimit.position).eulerAngles.z;

        sliderJoint.useMotor = useMotor;

        JointMotor2D motor = sliderJoint.motor;
        motor.motorSpeed = initialSpeed;
        motor.maxMotorTorque = motorForce;
        sliderJoint.motor = motor;

        // Attach body to joint
        if (body)
        {
            sliderJoint.connectedBody = body;
            sliderJoint.connectedAnchor = bodyAnchor;
        }
        else
        {
            Debug.LogError("Missing body on SliderController");
        }
    }
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go != null)
            {
                _joint = go.GetComponent<SliderJoint2D>();

                if(_joint!=null)
                {
                    _motor = _joint.motor;
                    _limits = _joint.limits;
                }
            }

            SetProperties();

            if(!everyFrame)
            {
                Finish();
            }
        }
 static public int GetMotorForce(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         System.Single             a1;
         checkType(l, 2, out a1);
         var ret = self.GetMotorForce(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int set_autoConfigureAngle(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.autoConfigureAngle = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    static void SliderJoint2D_jointSpeed(JSVCall vc)
    {
        UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
        var result = _this.jointSpeed;

        JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
    }
    static void SliderJoint2D_limitState(JSVCall vc)
    {
        UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
        var result = _this.limitState;

        JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
    }
	static public int set_angle(IntPtr l) {
		UnityEngine.SliderJoint2D o = (UnityEngine.SliderJoint2D)checkSelf(l);
		float v;
		checkType(l,2,out v);
		o.angle=v;
		return 0;
	}
	static public int set_limits(IntPtr l) {
		UnityEngine.SliderJoint2D o = (UnityEngine.SliderJoint2D)checkSelf(l);
		UnityEngine.JointTranslationLimits2D v;
		checkType(l,2,out v);
		o.limits=v;
		return 0;
	}
	static public int set_motor(IntPtr l) {
		UnityEngine.SliderJoint2D o = (UnityEngine.SliderJoint2D)checkSelf(l);
		UnityEngine.JointMotor2D v;
		checkType(l,2,out v);
		o.motor=v;
		return 0;
	}
	static public int set_useLimits(IntPtr l) {
		UnityEngine.SliderJoint2D o = (UnityEngine.SliderJoint2D)checkSelf(l);
		bool v;
		checkType(l,2,out v);
		o.useLimits=v;
		return 0;
	}
 static public int get_jointTranslation(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.jointTranslation);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    static public int set_useMotor(IntPtr l)
    {
        UnityEngine.SliderJoint2D o = (UnityEngine.SliderJoint2D)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.useMotor = v;
        return(0);
    }
Example #13
0
 // Use this for initialization
 void Awake()
 {
     startPos = transform.position;
     targetPos = transform.GetChild(0).transform.position;
     smashSpeed = 70f;
     retractSpeed = 10f;
     distThresh = 0.015f;
     slider = GetComponent<SliderJoint2D> ();
     slider.connectedAnchor = startPos;
 }
Example #14
0
 void Start()
 {
     myTransform = transform;
     audioSource = GetComponent<AudioSource>();
     foreach (Transform ch in myTransform)
     {
         if (ch.CompareTag("Press")) { pressBody = ch; }
     }
     if(pressBody != null) { sj = pressBody.GetComponent<SliderJoint2D>(); }
     else { Debug.LogError(this.name + " does not have a child with tag 'Press'", this); }
 }
Example #15
0
 static public int get_autoConfigureAngle(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.autoConfigureAngle);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.SliderJoint2D o;
			o=new UnityEngine.SliderJoint2D();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Example #17
0
 static public int get_useMotor(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.useMotor);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #18
0
 static public int get_limitState(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         pushEnum(l, (int)self.limitState);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #19
0
 static public int get_useLimits(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         pushValue(l, self.useLimits);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #20
0
 static public int get_limitState(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.limitState);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #21
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D o;
         o = new UnityEngine.SliderJoint2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D o;
         o=new UnityEngine.SliderJoint2D();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Example #23
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D o;
         o = new UnityEngine.SliderJoint2D();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.SliderJoint2D o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.SliderJoint2D();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
Example #25
0
 static public int set_limits(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D            self = (UnityEngine.SliderJoint2D)checkSelf(l);
         UnityEngine.JointTranslationLimits2D v;
         checkValueType(l, 2, out v);
         self.limits = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #26
0
 static public int set_useLimits(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.useLimits = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #27
0
 static public int set_limits(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D            self = (UnityEngine.SliderJoint2D)checkSelf(l);
         UnityEngine.JointTranslationLimits2D v;
         checkValueType(l, 2, out v);
         self.limits = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #28
0
 static public int set_useMotor(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.useMotor = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
	static public int GetMotorForce(IntPtr l) {
		try{
			UnityEngine.SliderJoint2D self=(UnityEngine.SliderJoint2D)checkSelf(l);
			System.Single a1;
			checkType(l,2,out a1);
			System.Single ret=self.GetMotorForce(a1);
			pushValue(l,ret);
			return 1;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
Example #30
0
 static public int set_angle(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.angle = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
// fields

// properties
    static void SliderJoint2D_angle(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
            var result = _this.angle;
            JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
        }
        else
        {
            System.Single             arg0  = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
            UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
            _this.angle = arg0;
        }
    }
Example #32
0
 static public int GetMotorForce(IntPtr l)
 {
     try {
         UnityEngine.SliderJoint2D self = (UnityEngine.SliderJoint2D)checkSelf(l);
         System.Single             a1;
         checkType(l, 2, out a1);
         var ret = self.GetMotorForce(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void SliderJoint2D_useLimits(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
         var result = _this.useLimits;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean            arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
         _this.useLimits = arg0;
     }
 }
 static void SliderJoint2D_motor(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
         var result = _this.motor;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.JointMotor2D  arg0  = (UnityEngine.JointMotor2D)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
         _this.motor = arg0;
     }
 }
 static void SliderJoint2D_limits(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.SliderJoint2D _this = (UnityEngine.SliderJoint2D)vc.csObj;
         var result = _this.limits;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.JointTranslationLimits2D arg0  = (UnityEngine.JointTranslationLimits2D)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.SliderJoint2D            _this = (UnityEngine.SliderJoint2D)vc.csObj;
         _this.limits = arg0;
     }
 }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.SliderJoint2D sliderJoint2D = (UnityEngine.SliderJoint2D)value;
     writer.WriteProperty("autoConfigureAngle", sliderJoint2D.autoConfigureAngle);
     writer.WriteProperty("angle", sliderJoint2D.angle);
     writer.WriteProperty("useMotor", sliderJoint2D.useMotor);
     writer.WriteProperty("useLimits", sliderJoint2D.useLimits);
     writer.WriteProperty("motor", sliderJoint2D.motor);
     writer.WriteProperty("limits", sliderJoint2D.limits);
     writer.WriteProperty("anchor", sliderJoint2D.anchor);
     writer.WriteProperty("connectedAnchor", sliderJoint2D.connectedAnchor);
     writer.WriteProperty("autoConfigureConnectedAnchor", sliderJoint2D.autoConfigureConnectedAnchor);
     writer.WriteProperty("connectedBody", sliderJoint2D.connectedBody);
     writer.WriteProperty("enableCollision", sliderJoint2D.enableCollision);
     writer.WriteProperty("breakForce", sliderJoint2D.breakForce);
     writer.WriteProperty("breakTorque", sliderJoint2D.breakTorque);
     writer.WriteProperty("enabled", sliderJoint2D.enabled);
     writer.WriteProperty("tag", sliderJoint2D.tag);
     writer.WriteProperty("name", sliderJoint2D.name);
     writer.WriteProperty("hideFlags", sliderJoint2D.hideFlags);
 }
Example #37
0
    void RetractGrapple(bool immediate = false)
    {
        if (immediate || IsArm)
        {
            state = State.Cocked;
            PlayerBehavior.Player.RefreshInputHints();

            if (sliderJoint)
            {
                Destroy(sliderJoint);
                sliderJoint = null;
            }

            if (distanceJoint)
            {
                Destroy(distanceJoint);
                distanceJoint = null;
            }

            // Retract grappling hook back to base
            projectile.ResetProjectile();
            shouldAim = true;
            fired = false;

            SFXSource.PlayOneShot(releaseClip);
            spriteRenderer.sprite = cockedSprite;
        }
        else
        {
            // if stuck in ground, slide down to retract first...
            if (projectile.AttachedToPoint)
            {
                state = State.Retracting;
                PlayerBehavior.Player.RefreshInputHints();
            }
            else
            {
                RetractGrapple(true);
            }
        }
    }
Example #38
0
    protected virtual void OnGrappleHit(Collision2D hit)
    {
        ropeLength = Vector2.Distance(ropeStart.position, ropeEnd.position);

        state = State.Attached;

        PlayerBehavior.Player.RefreshInputHints();

        shouldAim = false;

        playerBody = getRootComponent().rigidbody2D;
        if (playerBody)
        {
            if (IsArm)
            {
                // Create distance joint between grapple base and hook
                distanceJoint = playerBody.gameObject.AddComponent<DistanceJoint2D>();
                distanceJoint.anchor = ropeStart.position - playerBody.transform.position;
                distanceJoint.connectedBody = projectile.rigidbody2D;
                distanceJoint.distance = Vector2.Distance(ropeStart.position, projectile.transform.position);
                distanceJoint.maxDistanceOnly = true;
            }
            else
            {
                Rigidbody2D anchorBody = projectile.rigidbody2D;
                projectile.transform.rotation = Quaternion.identity;

                sliderJoint = playerBody.gameObject.AddComponent<SliderJoint2D>();
                sliderJoint.anchor = ropeStart.position - playerBody.transform.position;
                sliderJoint.angle = 270;

                sliderJoint.connectedBody = anchorBody;
                sliderJoint.connectedAnchor = ropeEnd.transform.position.XY()
                    - anchorBody.transform.position.XY();

                JointMotor2D motor = sliderJoint.motor;
                motor.motorSpeed = 0.0f;
                sliderJoint.motor = motor;
                sliderJoint.useMotor = true;
            }
        }
    }
Example #39
0
    public override void Update()
    {
        base.Update();

        if (chainRenderer != null)
        {
            chainRenderer.sortingLayer = spriteRenderer.sortingLayerName;
        }

        if (sliderJoint)
        {
            JointMotor2D motor = sliderJoint.motor;

            if (isActive && Input.GetKey(KeyCode.W) && ropeLength < maxRopeLength)
            {
                // Extend
                motor.motorSpeed = legPushSpeed;
            }
            else if (isActive && Input.GetKey(KeyCode.S) && ropeLength > minLegLength)
            {
                // Retract
                motor.motorSpeed = -legPushSpeed;
            }
            else
            {
                motor.motorSpeed = 0;
            }

            sliderJoint.motor = motor;
        }

        if (!IsArm && sliderJoint && playerBody)
        {
            sliderJoint.anchor = ropeStart.position - playerBody.transform.position;
        }

        if (state == State.Retracting)
        {
            if (!IsArm && ropeLength > minLegLength)
            {
                // Retract
                JointMotor2D motor = sliderJoint.motor;
                motor.motorSpeed = -legRetractSpeed;
                sliderJoint.motor = motor;
            }
            else
            {
                // Detach
                projectile.ResetProjectile();
                shouldAim = true;
                fired = false;

                if (sliderJoint)
                {
                    Destroy(sliderJoint);
                    sliderJoint = null;
                }

                state = State.Cocked;
                PlayerBehavior.Player.RefreshInputHints();
            }
        }

        if (state == State.Attached && IsArm)
        {
            if (ropeLength > minRopeLength) // hack that reduces some wierd oscillation issues
            {
                // Orient arm in direction of clamp
                Animator anim = getRootComponent().GetComponentInChildren<Animator>();
                Vector3 direction = Vector3.Normalize(ropeEnd.position - ropeStart.position);
                string xVar = parentAttachmentPoint.aimX;
                string yVar = parentAttachmentPoint.aimY;

                anim.SetBool(parentAttachmentPoint.animatorAimFlag, true);

                if (Skeleton.direction == PlayerSkeleton.Direction.Right)
                {
                    direction.x *= -1;
                }

                if (anim)
                {
                    anim.SetFloat(xVar, direction.x);
                    anim.SetFloat(yVar, direction.y);
                }
            }
        }
    }
		private static extern float INTERNAL_CALL_GetMotorForce(SliderJoint2D self, float timeStep);
Example #41
0
 // Use this for initialization
 protected override void Start()
 {
     base.Start();
     joint = GetComponent<SliderJoint2D>();
 }
Example #42
0
 protected void Start()
 {
     base.Start ();
     mSliderJoint = GetComponent<SliderJoint2D> ();
     mHalfLimits = ((Mathf.Abs (mSliderJoint.limits.max) - Mathf.Abs (mSliderJoint.limits.min)) / 2);
 }
Example #43
0
	// Use this for initialization
	void Start () {

		slide.useLimits = false;
		slide = GetComponent<SliderJoint2D>();
	}
Example #44
0
    public void Start()
    {
        // Create slider joint if necessary, connect to door body
        doorSlider = GetComponent<SliderJoint2D>();
        if (doorSlider == null)
        {
            doorSlider = gameObject.AddComponent<SliderJoint2D>();
        }
        doorSlider.connectedBody = doorBody;

        doorSlider.angle = Vector2.Angle(Vector3.right, openPosition.position - closedPosition.position);

        var limits = doorSlider.limits;
        limits.min = 0;
        limits.max = Vector2.Distance(openPosition.position, closedPosition.position);
        doorSlider.limits = limits;
        doorSlider.useLimits = true;

        var motor = doorSlider.motor;
        motor.motorSpeed = 0f;
        doorSlider.motor = motor;
        doorSlider.useMotor = true;

        LoadState();
    }
Example #45
0
 // Use this for initialization
 void Reset()
 {
     hinge = this.GetComponent<HingeJoint2D>();
     slider = this.GetComponent<SliderJoint2D>();
     body = this.GetComponent<Rigidbody2D>();
 }
	void Start () {
		slide 		= GetComponent<SliderJoint2D> ();
		changeTime  = Time.fixedTime;
	}
Example #47
0
    // Use this for initialization
    void Start()
    {
        Transform torsoObj = transform.Find("Torso");
        TorsoRB = torsoObj.GetComponent<Rigidbody2D>();

        Transform groundCollider = transform.Find("GroundCollider");
        GroundMotor = groundCollider.GetComponent<SliderJoint2D>();

        GroundTrigger = GetComponentInChildren<GroundTrigger>();
        InputManager = GetComponent<InputManager>();
        PlayerRotation = GetComponentInChildren<PlayerRotation>();
        VineTrigger = GetComponentInChildren<VineTrigger>();

        Animator = GetComponentInChildren<Animator>();

        RightArmRB = transform.Find("Torso/UpperArm_R/LowerArm_R").GetComponent<Rigidbody2D>();
        LeftArmRB = transform.Find("Torso/UpperArm_L/LowerArm_L").GetComponent<Rigidbody2D>();
        HandOffset = transform.Find("Torso/UpperArm_R/LowerArm_R/ArmEndPoint_R").localPosition;

        ChangeState(STATE.FRONT_FLIP);
    }