The wheel joint allows the simulation of wheels by providing a constraining suspension motion with an optional motor.

Inheritance: AnchoredJoint2D
 static public int GetMotorTorque(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.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         System.Single            a1;
         checkType(l, 2, out a1);
         var ret = self.GetMotorTorque(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_suspension(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.WheelJoint2D      self = (UnityEngine.WheelJoint2D)checkSelf(l);
         UnityEngine.JointSuspension2D v;
         checkValueType(l, 2, out v);
         self.suspension = 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 WheelJoint2D_jointSpeed(JSVCall vc)
    {
        UnityEngine.WheelJoint2D _this = (UnityEngine.WheelJoint2D)vc.csObj;
        var result = _this.jointSpeed;

        JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
    }
Exemple #4
0
		// Use this for initialization
		void Start ()
		{
				RigidFrontWheel = frontWheel.GetComponent<Rigidbody2D> ();
				RigidRearWheel = rearWheel.GetComponent<Rigidbody2D> ();
				WjFrontWheel = RigidFrontWheel.GetComponent<WheelJoint2D> ();
				WjRearWheel = RigidRearWheel.GetComponent<WheelJoint2D> ();
		}
Exemple #5
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.WheelJoint2D o;
     o = new UnityEngine.WheelJoint2D();
     pushObject(l, o);
     return(1);
 }
 static public int get_jointLinearSpeed(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.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.jointLinearSpeed);
         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
 }
Exemple #7
0
 static public int set_suspension(IntPtr l)
 {
     UnityEngine.WheelJoint2D      o = (UnityEngine.WheelJoint2D)checkSelf(l);
     UnityEngine.JointSuspension2D v;
     checkType(l, 2, out v);
     o.suspension = v;
     return(0);
 }
Exemple #8
0
 static public int set_motor(IntPtr l)
 {
     UnityEngine.WheelJoint2D o = (UnityEngine.WheelJoint2D)checkSelf(l);
     UnityEngine.JointMotor2D v;
     checkType(l, 2, out v);
     o.motor = v;
     return(0);
 }
Exemple #9
0
    static public int set_useMotor(IntPtr l)
    {
        UnityEngine.WheelJoint2D o = (UnityEngine.WheelJoint2D)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.useMotor = v;
        return(0);
    }
 static public int get_motor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         pushValue(l, self.motor);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #11
0
 static public int get_motor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.motor);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D o;
         o = new UnityEngine.WheelJoint2D();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D o;
         o = new UnityEngine.WheelJoint2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D o;
         o=new UnityEngine.WheelJoint2D();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D o;
         o=new UnityEngine.WheelJoint2D();
         pushValue(l,true);
         pushValue(l,o);
         return 2;
     }
     catch(Exception e) {
         return error(l,e);
     }
 }
Exemple #16
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.WheelJoint2D o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.WheelJoint2D();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
Exemple #17
0
 static public int set_useMotor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.useMotor = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_useMotor(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D self = (UnityEngine.WheelJoint2D)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 set_suspension(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D      self = (UnityEngine.WheelJoint2D)checkSelf(l);
         UnityEngine.JointSuspension2D v;
         checkType(l, 2, out v);
         self.suspension = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #20
0
 static public int set_suspension(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D      self = (UnityEngine.WheelJoint2D)checkSelf(l);
         UnityEngine.JointSuspension2D v;
         checkValueType(l, 2, out v);
         self.suspension = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    void Awake()
    {
        upper = transform.Find("Cart/Upper").GetComponent<Rigidbody2D>();
        lower = transform.Find("Cart/Lower").GetComponent<Rigidbody2D>();
        wheel = transform.Find("Cart/Wheel").GetComponent<Rigidbody2D>();
        wheelJoint = wheel.transform.GetComponentInChildren<WheelJoint2D>();
        evaluation = GetComponent<EvaluationBehaviour>();

        if (json != null) {
          var genotype = NEAT.Genotype.FromJSON(JSON.Deserialize(json.text));
          Assert.AreEqual(JSON.Serialize(genotype.ToJSON()), json.text.Trim(),
        "JSON should be compatible round-trip");
          Network = NetworkPorts.FromGenotype(genotype);
        }
    }
 static void WheelJoint2D_motor(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.WheelJoint2D _this = (UnityEngine.WheelJoint2D)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.WheelJoint2D _this = (UnityEngine.WheelJoint2D)vc.csObj;
         _this.motor = arg0;
     }
 }
Exemple #23
0
 static public int GetMotorTorque(IntPtr l)
 {
     try {
         UnityEngine.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         System.Single            a1;
         checkType(l, 2, out a1);
         var ret = self.GetMotorTorque(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #24
0
 static public int GetMotorTorque(IntPtr l)
 {
     try{
         UnityEngine.WheelJoint2D self = (UnityEngine.WheelJoint2D)checkSelf(l);
         System.Single            a1;
         checkType(l, 2, out a1);
         System.Single ret = self.GetMotorTorque(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static void WheelJoint2D_useMotor(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.WheelJoint2D _this = (UnityEngine.WheelJoint2D)vc.csObj;
         var result = _this.useMotor;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean           arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.WheelJoint2D _this = (UnityEngine.WheelJoint2D)vc.csObj;
         _this.useMotor = arg0;
     }
 }
Exemple #26
0
 /// <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.WheelJoint2D wheelJoint2D = (UnityEngine.WheelJoint2D)value;
     writer.WriteProperty("suspension", wheelJoint2D.suspension);
     writer.WriteProperty("useMotor", wheelJoint2D.useMotor);
     writer.WriteProperty("motor", wheelJoint2D.motor);
     writer.WriteProperty("anchor", wheelJoint2D.anchor);
     writer.WriteProperty("connectedAnchor", wheelJoint2D.connectedAnchor);
     writer.WriteProperty("autoConfigureConnectedAnchor", wheelJoint2D.autoConfigureConnectedAnchor);
     writer.WriteProperty("connectedBody", wheelJoint2D.connectedBody);
     writer.WriteProperty("enableCollision", wheelJoint2D.enableCollision);
     writer.WriteProperty("breakForce", wheelJoint2D.breakForce);
     writer.WriteProperty("breakTorque", wheelJoint2D.breakTorque);
     writer.WriteProperty("enabled", wheelJoint2D.enabled);
     writer.WriteProperty("tag", wheelJoint2D.tag);
     writer.WriteProperty("name", wheelJoint2D.name);
     writer.WriteProperty("hideFlags", wheelJoint2D.hideFlags);
 }
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go != null)
            {
                _wj2d = go.GetComponent<WheelJoint2D>();

                if(_wj2d!=null)
                {
                    _motor = _wj2d.motor;
                    _suspension = _wj2d.suspension;
                }
            }

            SetProperties();

            if(!everyFrame)
            {
                Finish();
            }
        }
	void Start ()
	{
		junta = GetComponent<WheelJoint2D> ();
		junta.useMotor = true;
		motor.maxMotorTorque = 10000;
	}
Exemple #29
0
 public void SetRefToJoint(WheelJoint2D joint)
 {
     wjoint = joint;
 }
Exemple #30
0
 static public int get_jointSpeed(IntPtr l)
 {
     UnityEngine.WheelJoint2D o = (UnityEngine.WheelJoint2D)checkSelf(l);
     pushValue(l, o.jointSpeed);
     return(1);
 }
Exemple #31
0
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.WheelJoint2D wheelJoint2D = SaveGameType.CreateComponent <UnityEngine.WheelJoint2D> ();
     ReadInto(wheelJoint2D, reader);
     return(wheelJoint2D);
 }
Exemple #32
0
 static public int get_motor(IntPtr l)
 {
     UnityEngine.WheelJoint2D o = (UnityEngine.WheelJoint2D)checkSelf(l);
     pushValue(l, o.motor);
     return(1);
 }
Exemple #33
0
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.WheelJoint2D wheelJoint2D = (UnityEngine.WheelJoint2D)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "suspension":
                    wheelJoint2D.suspension = reader.ReadProperty <UnityEngine.JointSuspension2D> ();
                    break;

                case "useMotor":
                    wheelJoint2D.useMotor = reader.ReadProperty <System.Boolean> ();
                    break;

                case "motor":
                    wheelJoint2D.motor = reader.ReadProperty <UnityEngine.JointMotor2D> ();
                    break;

                case "anchor":
                    wheelJoint2D.anchor = reader.ReadProperty <UnityEngine.Vector2> ();
                    break;

                case "connectedAnchor":
                    wheelJoint2D.connectedAnchor = reader.ReadProperty <UnityEngine.Vector2> ();
                    break;

                case "autoConfigureConnectedAnchor":
                    wheelJoint2D.autoConfigureConnectedAnchor = reader.ReadProperty <System.Boolean> ();
                    break;

                case "connectedBody":
                    if (wheelJoint2D.connectedBody == null)
                    {
                        wheelJoint2D.connectedBody = reader.ReadProperty <UnityEngine.Rigidbody2D> ();
                    }
                    else
                    {
                        reader.ReadIntoProperty <UnityEngine.Rigidbody2D> (wheelJoint2D.connectedBody);
                    }
                    break;

                case "enableCollision":
                    wheelJoint2D.enableCollision = reader.ReadProperty <System.Boolean> ();
                    break;

                case "breakForce":
                    wheelJoint2D.breakForce = reader.ReadProperty <System.Single> ();
                    break;

                case "breakTorque":
                    wheelJoint2D.breakTorque = reader.ReadProperty <System.Single> ();
                    break;

                case "enabled":
                    wheelJoint2D.enabled = reader.ReadProperty <System.Boolean> ();
                    break;

                case "tag":
                    wheelJoint2D.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    wheelJoint2D.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    wheelJoint2D.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
Exemple #34
0
	// Use this for initialization
	void Start () {
        r = GetComponent<Rigidbody2D>();
        wheel1 = GetComponent<WheelJoint2D>();
	}
Exemple #35
0
 static public int get_suspension(IntPtr l)
 {
     UnityEngine.WheelJoint2D o = (UnityEngine.WheelJoint2D)checkSelf(l);
     pushValue(l, o.suspension);
     return(1);
 }
 private static extern float INTERNAL_CALL_GetMotorTorque(WheelJoint2D self, float timeStep);
Exemple #37
0
 public float GetMotorTorque(float timeStep)
 {
     return(WheelJoint2D.INTERNAL_CALL_GetMotorTorque(this, timeStep));
 }
 // Use this for initialization
 void Start()
 {
     rearWheelJoint = rearSuspensionRigidBody.GetComponent<HingeJoint2D>();
     frontWheelJoint = GetComponent<WheelJoint2D> ();
 }
 // Use this for initialization
 void Start()
 {
     joint = GetComponent<WheelJoint2D>();
     motor = new JointMotor2D();
     motor.maxMotorTorque = 10000;
 }
Exemple #40
0
 private static extern float INTERNAL_CALL_GetMotorTorque(WheelJoint2D self, float timeStep);
	// Use this for initialization
	void Start () 
    {
        wheelJoint = GetComponent<WheelJoint2D>();
	}
Exemple #42
0
 private static float INTERNAL_CALL_GetMotorTorque(WheelJoint2D self, float timeStep)
 {
     throw new NotImplementedException("なにこれ");
 }