Paul Hexem Posted October 23, 2013 Share Posted October 23, 2013 http://pastebin.com/dWGretHe I'm trying to keep a pair of engines on the side of a vehicle level. When the nose tilts up or down on the X axis, the engines stay level just fine. However, when I turn right or left on the Z axis, they go the opposite direction.Any idea why? Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 23, 2013 Share Posted October 23, 2013 I'm no vehicle expert, but have you looked at VEHICLE_BANKING_EFFICIENCY? Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 Maybe I should simply ask- is there ANY way to keep a linked prim level along just one axis? Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 Rolig Loon wrote: I'm no vehicle expert, but have you looked at VEHICLE_BANKING_EFFICIENCY? That has nothing to do with my problem. I need to use llSetLocalRot on a couple child prims, but I can't figure out how to calculate the rotation I need. Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 23, 2013 Share Posted October 23, 2013 Sorry. You said you were dealing with a vehicle so I assumed incorrectly that it was a physical vehicle with a banking problem. I'm clearly not visualizing what you are wrestling with. If you were dealing with a physical vehicle, then one answer to your question about keeping child prims level would be to use llSetSatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE); But that doesn't seem to fit what you are doing. /me goes back to sleep. Link to comment Share on other sites More sharing options...
steph Arnott Posted October 23, 2013 Share Posted October 23, 2013 Firstly I have no idea if those prims are at ZERO_VECTOR on your build or rotated, rotated which will effect the llGetLocalRot and secondly seeing the script and what it is doing. Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted October 23, 2013 Share Posted October 23, 2013 So, if I understand this correctly, you have a flying vehicle with gimbaled (or maybe better described as hinged) engines that are not moving as you wish during a turn. That they're moving at all suggests you're already using llSetLocalRot to move them, so you're asking for the proper coordinate conversion to make them go as you wish? Did I get that right? Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 The fact that nobody gets me tells me that I may have found something impossible to do in SL... Look at an V-22 Osprey. http://upload.wikimedia.org/wikipedia/commons/f/f5/US_Navy_080220-N-5180F-015_A_Marine_Corps_MV-22_Osprey_prepares_to_land_aboard_the_amphibious_assault_ship_USS_Nassau_(LHA_4).jpg Imagine those engines and rotors had to stay level, even while the nose is tilting up and down. My object isn't going to bank; I'm not worried about that. It's not using a vehicle script, it's using llMoveToTarget and llLookAt(or llSetRot, I haven't decided yet). Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 Madelaine McMasters wrote: So, if I understand this correctly, you have a flying vehicle with gimbaled (or maybe better described as hinged) engines that are not moving as you wish during a turn. That they're moving at all suggests you're already using llSetLocalRot to move them, so you're asking for the proper coordinate conversion to make them go as you wish? Did I get that right? Basically, yes. Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 They are rotated- but I don't even care about that right now. I'd be happy to just get it to work on ZERO_ROTATION- I can math for the 90 degree rotation after that with pi. Link to comment Share on other sites More sharing options...
steph Arnott Posted October 23, 2013 Share Posted October 23, 2013 integer DIRECTION = 1;// - for opp direction rot = llGetLocalRot(); delta = llEuler2Rot(<0, DIRECTION * PI, 0>); rot = delta * rot; Link to comment Share on other sites More sharing options...
LepreKhaun Posted October 23, 2013 Share Posted October 23, 2013 Do us a favor, please, and post the code you're using, what it does and how it differs from what you want done. That way we can actually see what the problem is and attempt to correct it. Otherwise, it's like a futile game of LSL charades. Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 steph Arnott wrote: integer DIRECTION = 1;// - for opp direction rot = llGetLocalRot(); delta = llEuler2Rot(<0, DIRECTION * PI, 0>); rot = delta * rot; That's got it rotating like a helicopter rotor, doesn't attempt to stay level on any axis. Link to comment Share on other sites More sharing options...
steph Arnott Posted October 23, 2013 Share Posted October 23, 2013 Forget it my patience has run out. Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 list body_list;rotation body_rot;vector body_euler;list engine_list;rotation engine_rot;vector engine_euler;get_rots(){ integer num = llGetNumberOfPrims(); integer i; for (i=1; i < num + 1; i++) { if(llGetLinkName(i) == "body") { body_list = llGetLinkPrimitiveParams(i, [PRIM_ROTATION]); body_rot = llList2Rot(body_list, 0); body_euler = llRot2Euler(body_rot); //llSay(0, "body: " + (string)body_euler); } if(llGetLinkName(i) == "engine") { engine_list = llGetLinkPrimitiveParams(i, [PRIM_ROTATION]); engine_rot = llList2Rot(engine_list, 0); engine_euler = llRot2Euler(engine_rot); //llSay(0, "engine: " + (string)engine_euler); } }}set_rots(){ integer num = llGetNumberOfPrims(); integer i; for (i=1; i < num + 1; i++) { if(llGetLinkName(i) == "engine") { engine_list = llGetLinkPrimitiveParams(i, [PRIM_ROTATION]); engine_rot = llList2Rot(engine_list, 0); engine_euler = llRot2Euler(engine_rot); llSetLinkPrimitiveParamsFast(i, [PRIM_ROT_LOCAL, llEuler2Rot(<PI/2, body_euler.y, 0.0>)/body_rot]); //llSay(0, "engine: " + (string)engine_euler); } }}default{ state_entry() { llSetTimerEvent(2.5); } timer() { get_rots(); set_rots(); }} That's what I'm using right now. When I tilt the nose up or down, the engines stay level. When the whole thing is level and I turn it right or left, they turn right or left correctly. When I tilt the nose down, then turn it right or left, the engines stay level, but they turn in a seemingly unrelated direction. Link to comment Share on other sites More sharing options...
LepreKhaun Posted October 23, 2013 Share Posted October 23, 2013 OK, you're just going about it the wrong way is all. Use prim rotation for pitching your "body" up and down. For anything else, just rotate the object in its entirety. Link to comment Share on other sites More sharing options...
Paul Hexem Posted October 23, 2013 Author Share Posted October 23, 2013 It's a 22 prim linkset, and the tail and nose are separate prims. The entire linkset has to move together- only the engines can tilt. If I try to pitch just the body prim, it'll make a huge mess of the linkset. Link to comment Share on other sites More sharing options...
revochen Mayne Posted October 23, 2013 Share Posted October 23, 2013 Hello, I guess you need to get the root prims rotation first and then set its opposite angle for x and y axis on the engine prim. Link to comment Share on other sites More sharing options...
LepreKhaun Posted October 23, 2013 Share Posted October 23, 2013 Gadget Portal wrote: It's a 22 prim linkset, and the tail and nose are separate prims. The entire linkset has to move together- only the engines can tilt. If I try to pitch just the body prim, it'll make a huge mess of the linkset. OK, some of your prims make up your engines and some make up the body then, yes? And you want the whole of it to perform the same as a VTOL- where the engines swivel in place on the wings but otherwise stay in the same relative position to the rest of the linkset as it flies around, right? What you're trying to do in that case is called hierarchical object composition and, though not directly supported in SL, https://wiki.secondlife.com/wiki/Prim_and_Object_Hierarchy, can be implemented in code, https://wiki.secondlife.com/wiki/Hierarchics. 1 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