Wulfie Reanimator Posted April 11, 2019 Share Posted April 11, 2019 So I have this little thing. It's a turret that rolls around its base to aim around itself, and pitches the cylindrical cannon to aim for targets at different altitudes. This turret is linked to a larger linkset, so neither of them is the root (but the root's center will be the bottom of the base). I'm having trouble with the math behind this, as usual. Rotating the base is pretty easy: vector target_position; // Could be anything. vector direction = llVecNorm(target_position - llGetPos()); direction.z = 0; // Ignore the Z offset, the base MUST stay upright. rotation final = llRotBetween(<1,0,0>, direction); llSetLinkPrimitiveParamsFast(2, [PRIM_ROTATION, final]); Even going so far as rotating both, the base and the cannon to face the same direction is trivial, but I don't know how to add to the cannon's local Y rotation so that it would only pitch up/down without rolling around itself and looking all wonky. 1 Link to comment Share on other sites More sharing options...
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