parent and child
1: my first problem is : i get exactly 44.9901 with me using this script
if(transform.eulerAngles.z==135) { transform.rotation = Quaternion.Euler(transform.eulerAngles.x,transform.eulerAngles.y,45); } i dont know why it's 2d , there is no rigidbody nothing else except 2dcollider.
2: second problem is child and his parent , i had written this code to stop the child moving from the start pos while parent is constantly moving.
Vector2 trS = new Vector2(0,0);
child.transform.position = trS-parent.transform.position;
let me explain this code before you ask the meaning.
for example parent.trans.pos.x = 0 and child.trans.pos.x=0
if parent.tans.pos.x starts to change and become 1 unit for the child will stay 0 relative to the world but relative to his parent his pos.x=-1,, but with my script it seem that they're both running from trS(0,0)
3: the third one is the wierdest but i will post it on the first comment. if you know the solution please make it quick i'm stuck until the answer arrives thank.
Answer by Tyche10 · Nov 13, 2015 at 03:36 PM
I think your second problem is because you are changing transform.position (position in world space) instead of transform.localPosition (position relative to parent).
if child.pos.x=0(relative to parent) && parent.pos.x=0; if parent.pos.x=7 and child.pos.x(relative to world) stay = 0 then what would relative parent !? = -7 right but $$anonymous$$e becomes exactly -6.64 why?
Your answer
Follow this Question
Related Questions
Child always on parent top to get the number of dice 0 Answers
How do I find the rotation of a game object in relation to its grandparent 1 Answer
Changing parent at runtime rotates object. 0 Answers
How does child's rigid body affect parent's rigidbody? 1 Answer
Child object not rotating as parent 0 Answers