Canardia Posted February 14, 2010 Share Posted February 14, 2010 I can't figure out how to turn a mesh around an axis which is the parent entity's local axis. I have 3 nested rings, where ring1 is the outer ring. These 4 lines of code work fine, but I can't figure out how to turn ring2 around ring1's local axis. Ring1's parent is the world, so I can use the global parameter to turn it in the world's "local" space (which is ring1's global space). EntityParent(ring2,ring1); EntityParent(ring3,ring2); TurnEntity(ring1, Vec3(0,0,1), 1); TurnEntity(ring1, Vec3(0,1,0) ); TurnEntity(ring2, Vec3(1,0,0) ); //TurnEntity(ring2, Vec3(0,1,0) ); // doesn't work right TurnEntity(ring3, Vec3(0,0,1) ); //TurnEntity(ring3, Vec3(0,1,0) ); // doesn't work right Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Canardia Posted February 14, 2010 Author Share Posted February 14, 2010 Ahh, I found the solution, TFormVector does exactly what I want: It transforms a vector from another entity's space to another entity's space, so now everything works perfectly: TurnEntity(ring1, Vec3(0,0, ringspeed1*AppSpeed()), 1); TurnEntity(ring1, Vec3(0, ringspeed2*AppSpeed(),0) ); TurnEntity(ring2, TFormVector(Vec3(ringspeed1*AppSpeed(),0,0),ring1,ring2)); TurnEntity(ring2, Vec3(0, ringspeed2*AppSpeed(),0) ); TurnEntity(ring3, TFormVector(Vec3(0,0,ringspeed1*AppSpeed()),ring2,ring3)); TurnEntity(ring3, Vec3(0, ringspeed2*AppSpeed(),0) ); Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.