not able to rotate an object in the right direction when it is attached to another object(pls help!!!!!!)
using UnityEngine; using System.Collections;
public class sawscrit : MonoBehaviour { public float spedd = 20f; void Update () { transform.Rotate (0,0,spedd * Time.deltaTime); } }
this is the script attached to the object that has to be rotated in the z direction
Answer by JatMidGrade · Nov 22, 2016 at 04:10 PM
This is most likely because when you affect a transform on a "child" object, they are changed in relation to the parent. Have you tried altering your system to either unparent the object, or altered your code to ensure the object is rotating with actual respect to your current object? Also, have you tried using the object animator for this? It might give you a better way to do what you are trying.
If you have any more actual information here, it might be helpful to share. I'm not even sure what you are wanting exactly, and you need to tell us how it is operating incorrectly before the problem can be fixed. Is it rotating the wrong way or not at all? Does the child object HAVE to be attached to the parent object for your script to work (like something floating over the parent object and rotating, or does it just need to rotate as a general rule?)
Your answer
Follow this Question
Related Questions
How to make object rotate on android platform 2 Answers
have one object rotate another object on the y axis 0 Answers
how to lock object's rotation without rigidbody 2 Answers
Drag - Rotate 0 Answers
Rotatin an object around another object 0 Answers