EniMausi Posted February 15, 2015 Share Posted February 15, 2015 I accidantly post this tread in the wrong forum i guess...haven't saw the script section. My bad :( I found that OmegaTarget script, but it does not work a I want to. The final result should look like this:http://www.shutterstock.com/video/clip-2933809-stock-footage-abstract-rotating-cube-loop-able-d-anim...If I turn the cube the rotation axes goes with the object and doesn't stay an the z-axis to earth. Its for a logo in front of a building. The cube should spin on a corner and not an the flat side.... but I just can't get it to work with the omega script. Beside I am a totally noob on scripting. Hope somebody can help.and sry for my bad english Link to comment Share on other sites More sharing options...
Ohjiro Watanabe Posted February 15, 2015 Share Posted February 15, 2015 You have to do a trick here. Prims rotate around their centre, at least with Omega they do. But you want it to rotate on a corner. So you have to cut the prim so that the centre looks like it is a corner. Rez a prim and on the Object tab in Edit set the rotation to x=45 y=0 z=45 Now set Path Cut to B 0.375 E 0.625 and Slice B to 0.5 Now your Omega will work. default { state_entry() { // x y z speed acceleration llTargetOmega(<0,0,1>,1.0,0.001); } } 1 Link to comment Share on other sites More sharing options...
Ron Khondji Posted February 15, 2015 Share Posted February 15, 2015 First rotating the cube on a point and then starting llTargteOmega() works aswell.Just dump this script in a prim. default { state_entry() { llSetRot(llEuler2Rot(<35.264, 45.0, 0.0> * DEG_TO_RAD)); llTargetOmega(<0,0,1>, PI/4, 1.0); }} 1 Link to comment Share on other sites More sharing options...
Nova Convair Posted February 15, 2015 Share Posted February 15, 2015 You can use 2 prims. The small invisible root will rotate and the big cube you can link to it in any angle you want. Link to comment Share on other sites More sharing options...
EniMausi Posted February 15, 2015 Author Share Posted February 15, 2015 Thanks for the answers I figured it out some time after my post. I just build a pyramid with the omega script and linked the cube. Sometimes the solutions are so easy that you don't see them. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted February 15, 2015 Share Posted February 15, 2015 I would simply tell the script to position the cube as I wanted it, and then rotate it on the region's z axis rather than that of the cube. Thus: default{ state_entry() { rotation rot = llRotBetween(<1.0,1.0,1.0>,<0.0,0.0,1.0>); //find the angle between the cube's centre and the vertical up llSetRot(rot); //rotate it to that angle float speed = (TWO_PI/4.0); // one rotation every 4 seconds llTargetOmega( <0.0,0.0,1.0>, speed,0.1); }} ETA I think this is the same as Ron's solution, but mine is a bit more verbose and explicit about the steps involved. 2 Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 15, 2015 Share Posted February 15, 2015 That's assuming that the object to be rotated is in fact a cube. If you squish or elongate the cube along any of its axes, the body diagonal will no longer be <1,1,1>. You''l have to add a correction and then change one line in Innula's script ... vector vBody = llGetScale();rotation rot = llRotBetween(vBody,<0.0,0.0,1.0>); //find the angle between the body diagonal and the +Z axis 2 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted February 16, 2015 Share Posted February 16, 2015 Thanks, Rolig. I hadn't considered what to do if it's not a cube, but you're right, of course. This is one of the things I really like about the Scripting Forum -- someone asks a specific question, and we sometimes end up with a method that's generally applicable and many people must have wondered about in the past. In fact, I think I remember asking a similar question (at least about how to get the cube resting on its corner) ages ago, soon after I started learning to script, and Dora answering it. Link to comment Share on other sites More sharing options...
StrayCat Rhapsody Posted January 16 Share Posted January 16 Wow .. years old but just what I needed. Works perfectly Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now