how can I change the script so that I can rotate the object with the rigidbody component ? Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class mehanic : MonoBehaviour { public Transform detail1; public Transform detail2; public Transform detail3; void FixedUpdate() { if (Input.GetKey(KeyCode.E)) { //hinge.GetComponent(ConfigurableJoint).lowAngularXLimit = 10f; detail1.localRotation = Quaternion.RotateTowards(detail1.localRotation, Quaternion.Euler(new Vector3(30, 0, 0)), 20f * Time.deltaTime); } if (Input.GetKey(KeyCode.Q)) { detail1.localRotation = Quaternion.RotateTowards(detail1.localRotation, Quaternion.Euler(new Vector3(-30, 0, 0)), 20f * Time.deltaTime); } if (Input.GetKey(KeyCode.Y)) { detail2.localRotation = Quaternion.RotateTowards(detail2.localRotation, Quaternion.Euler(new Vector3(44, 0, 0)), 20f * Time.deltaTime); } if (Input.GetKey(KeyCode.U)) { detail2.localRotation = Quaternion.RotateTowards(detail2.localRotation, Quaternion.Euler(new Vector3(-21, 0, 0)), 20f * Time.deltaTime); } if (Input.GetKey(KeyCode.N)) { detail3.localRotation = Quaternion.RotateTowards(detail3.localRotation, Quaternion.Euler(new Vector3(40, 0, 0)), 20f * Time.deltaTime); } if (Input.GetKey(KeyCode.M)) { detail3.localRotation = Quaternion.RotateTowards(detail3.localRotation, Quaternion.Euler(new Vector3(-40, 0, 0)), 20f * Time.deltaTime); } } }
What object with a rigidbody component? You are only referencing transforms. Do the transforms have a parent with a rigidbody? You provide too little information for me to give you any proper answer.
I have an object that I manage with the help of this script, but at the same time I use joins, but for this I need and I used the iskinematic checkbox, but this is the result of which I need to, can I set the same rotation of the object according to the given axis when using rigidbody?