using UnityEngine;
using System.Collections;
public class limiteTranslation : MonoBehaviour {
public SliderJoint2D sj2d;
// Use this for initialization
void Start () {
sj2d = GetComponent<SliderJoint2D> ();
sj2d.useLimits = true;
}
// Update is called once per frame
void Update () {
}
void FixedUpdate()
{
float maxStep = Mathf.Abs (Mathf.Sin (Time.time)*28);
JointTranslationLimits2D jt2d = new JointTranslationLimits2D ();
jt2d.max = maxStep;
sj2d.limits = jt2d;
}
}
using System.Collections;
public class limiteTranslation : MonoBehaviour {
public SliderJoint2D sj2d;
// Use this for initialization
void Start () {
sj2d = GetComponent<SliderJoint2D> ();
sj2d.useLimits = true;
}
// Update is called once per frame
void Update () {
}
void FixedUpdate()
{
float maxStep = Mathf.Abs (Mathf.Sin (Time.time)*28);
JointTranslationLimits2D jt2d = new JointTranslationLimits2D ();
jt2d.max = maxStep;
sj2d.limits = jt2d;
}
}