UnityEngine.Rigidbody.AddRelativeTorque(UnityEngine.Vector3, UnityEngine.ForceMode)

Here are the examples of the csharp api UnityEngine.Rigidbody.AddRelativeTorque(UnityEngine.Vector3, UnityEngine.ForceMode) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 View Source File : ExampleWheelController.cs
License : MIT License
Project Creator : liangxiegame

void Update()
    {
        if (Input.GetKey (KeyCode.UpArrow)) // Rotate forward
            m_Rigidbody.AddRelativeTorque(new Vector3(-1 * acceleration, 0, 0), ForceMode.Acceleration); // Add forward torque to mesh
        else if (Input.GetKey (KeyCode.DownArrow)) // Rotate backward
            m_Rigidbody.AddRelativeTorque(new Vector3(1 * acceleration, 0, 0), ForceMode.Acceleration); // Add backward torque to mesh

        float m = -m_Rigidbody.angularVelocity.x / 100; // Calculate multiplier for motion vector texture

        if (motionVectorRenderer) // If the custom motion vector texture renderer exists
            motionVectorRenderer.material.SetFloat(Uniforms._MotionAmount, Mathf.Clamp(m, -0.25f, 0.25f)); // Set the multiplier on the renderer's material
    }

19 View Source File : UnityEngine_RigidbodyWrap.cs
License : MIT License
Project Creator : XINCGer

[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int AddRelativeTorque(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 2)
			{
				UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject<UnityEngine.Rigidbody>(L, 1);
				UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2);
				obj.AddRelativeTorque(arg0);
				return 0;
			}
			else if (count == 3)
			{
				UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject<UnityEngine.Rigidbody>(L, 1);
				UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2);
				UnityEngine.ForceMode arg1 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.ForceMode));
				obj.AddRelativeTorque(arg0, arg1);
				return 0;
			}
			else if (count == 4)
			{
				UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject<UnityEngine.Rigidbody>(L, 1);
				float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
				float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
				float arg2 = (float)LuaDLL.luaL_checknumber(L, 4);
				obj.AddRelativeTorque(arg0, arg1, arg2);
				return 0;
			}
			else if (count == 5)
			{
				UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject<UnityEngine.Rigidbody>(L, 1);
				float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
				float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
				float arg2 = (float)LuaDLL.luaL_checknumber(L, 4);
				UnityEngine.ForceMode arg3 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 5, typeof(UnityEngine.ForceMode));
				obj.AddRelativeTorque(arg0, arg1, arg2, arg3);
				return 0;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddRelativeTorque");
			}
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}