Posted By: Garrettwademan
Need a Math Pro (Parent / Child Rotation and XY coords) - 01/04/19 03:01
Okay guys, I am really sorry for this question, it seems so basic but I can't seem to get it. What I am trying to do is make a parent model (in this case the Computer Case) and child models (like CPU, RAM, Connectors) rotate in synconry yet keep their reletive X and Y positions to the computer case. Here is a video of what I have now, and here is the code I am using to do it. Is it because each model isn't aligned in its own axis in MED? Any help is greatly appreciated.
Its close, but not where it should be as it rotates.
YouTube Rotate Demo Current
Its close, but not where it should be as it rotates.
YouTube Rotate Demo Current
Code:
//my is each object such as CPU, RAM, Hard Drive, Circuit Board //arcade_Case is the Parent //varLocDifX is the offset of the my model, relative to the arcade_Case varLocDifX = my.x - arcade_Case.x; varLocDifY = my.y - arcade_Case.y; varLocDifZ = my.z - arcade_Case.z; my.pan = arcade_Case.pan; my.x = arcade_Case.x + varLocDifX * cos(arcade_Case.pan + 90); my.y = arcade_Case.y + varLocDifY * sin(arcade_Case.pan + 90); my.z = arcade_Case.z + varLocDifZ;