ainst Composer Posted March 4, 2019 Share Posted March 4, 2019 Hello! Is it possible to alter the script of the aviation speedometer, showing the horizontal speed in the speedometer, showing the vertical speed by rotating the texture? Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 4, 2019 Share Posted March 4, 2019 Speed is defined as llVecMag ( llGetVel() ) . If you want to know the component of speed that is due to motion in a specific direction, then you filter for that direction alone. As long as you stick to grid coordinate movement on X, Y, Z, that means you can get Speed (Vertical) from vector Vel = llGetVel(); llVecMag ( <0.0,0.0, Vel.z> ); and Non-vertical speed from llVecMag( < Vel.x, Vel.y, 0.0> ); 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 16 hours ago, Rolig Loon said: Speed is defined as llVecMag ( llGetVel() ) . If you want to know the component of speed that is due to motion in a specific direction, then you filter for that direction alone. As long as you stick to grid coordinate movement on X, Y, Z, that means you can get Speed (Vertical) from vector Vel = llGetVel(); llVecMag ( <0.0,0.0, Vel.z> ); and Non-vertical speed from llVecMag( < Vel.x, Vel.y, 0.0> ); Here is part of this script. Can you please tell me if this is here and what needs to be changed? SetInstruments() { if(llGetLinkName(instrument_link_number) != instrument_link_name) return; // we do this incase the links change float speed = ((llVecMag(llGetVel()) * 1.94384) * speed_scale); //get the horizontal speed in knots and scale it based on what we set at the top of the script //Speed float xyz_angles = (speed * -1.0) * (360.0 / 300.0) + 90.0; float angles_in_radians = xyz_angles * DEG_TO_RAD; // Change to Radians llSetLinkPrimitiveParamsFast(instrument_link_number, [ PRIM_TEXTURE, 0, instrument_needle_uuid, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, angles_in_radians]); } Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2019 Share Posted March 5, 2019 That's what it looks like. Whoever wrote this is assuming that you are flying horizontally (not a bad assumption most of the time). so s/he's just using the entire llGetVel() vector in that calculation of speed. The rest is all scaling factors, first from m/sec to knots and then with a fudge factor (speed_scale) that probably parameterises the value for that meter. The last three lines are converting the speed into movement of the hand on a dial. Incidentally, the very first line is a clumsy cop-out for not having bothered to get the right link numbers when the script resets. Basically, it's saying, "If I screwed up, this meter is dead, so don't bother calculating speed." 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 (edited) 2 hours ago, Rolig Loon said: That's what it looks like. Whoever wrote this is assuming that you are flying horizontally (not a bad assumption most of the time). so s/he's just using the entire llGetVel() vector in that calculation of speed. The rest is all scaling factors, first from m/sec to knots and then with a fudge factor (speed_scale) that probably parameterises the value for that meter. The last three lines are converting the speed into movement of the hand on a dial. Incidentally, the very first line is a clumsy cop-out for not having bothered to get the right link numbers when the script resets. Basically, it's saying, "If I screwed up, this meter is dead, so don't bother calculating speed." Thanks very much! That is, in whatever direction I fly, it will show the speed, even when moving up / down, and I cannot convert it into a vertical speedometer, or I will have to redo the whole script? Edited March 5, 2019 by ainst Composer Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2019 Share Posted March 5, 2019 2 minutes ago, ainst Composer said: That is, in whatever direction I fly, it will show the speed, even when moving up / down, and I cannot convert it into a vertical speedometer, or I will have to redo the whole script? Right. It is doing what any normal speedometer does .... tells you your speed. If you want to know your vertical speed for some reason -- to tell you your rate of climb or descent -- you'd need to have a separate dial gauge exactly like this one but scripted to work with just the vertical component of llGetVel instead of the whole thing, as I explained earlier. 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 Just now, Rolig Loon said: Right. It is doing what any normal speedometer does .... tells you your speed. If you want to know your vertical speed for some reason -- to tell you your rate of climb or descent -- you'd need to have a separate dial gauge exactly like this one but scripted to work with just the vertical component of llGetVel instead of the whole thing, as I explained earlier. So If i just make it ... it will work? float speed = ((llVecMag ( <0.0,0.0, Vel.z> );) * 1.94384) * speed_scale); Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2019 Share Posted March 5, 2019 (edited) For measuring your vertical speed, yes. (Well, clean it up.) Edited March 5, 2019 by Rolig Loon 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 2 minutes ago, Rolig Loon said: For measuring your vertical speed, yes. (Well, clean it up.) Great! Thanks very much! Link to comment Share on other sites More sharing options...
steph Arnott Posted March 5, 2019 Share Posted March 5, 2019 (edited) 8 minutes ago, ainst Composer said: So If i just make it ... it will work? float speed = ((llVecMag ( <0.0,0.0, Vel.z> );) * 1.94384) * speed_scale); Any reason why you added this at the fourth parenthesis ' ; ' ? Edited March 5, 2019 by steph Arnott 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2019 Share Posted March 5, 2019 1 minute ago, steph Arnott said: Any reason why you added this at the fourth parenthisis ' ; ' ? That's why I said to "clean it up" 😉 And I am assuming that he defined the variable Vel as I advised. 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 2 minutes ago, steph Arnott said: Any reason why you added this at the fourth parenthisis ' ; ' ? Hi! Oh just copypaste, sorry! Link to comment Share on other sites More sharing options...
steph Arnott Posted March 5, 2019 Share Posted March 5, 2019 (edited) 3 minutes ago, Rolig Loon said: That's why I said to "clean it up" 😉 And I am assuming that he defined the variable Vel as I advised. I was predicting a probable future event on this page. Edited March 5, 2019 by steph Arnott 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 3 minutes ago, Rolig Loon said: That's why I said to "clean it up" 😉 And I am assuming that he defined the variable Vel as I advised. If already such a topic, a related question arose: how to make it show only horizontal speed? (llVecMag ( <Vel.x,Vel.y,0.0> ) Link to comment Share on other sites More sharing options...
steph Arnott Posted March 5, 2019 Share Posted March 5, 2019 5 minutes ago, ainst Composer said: If already such a topic, a related question arose: how to make it show only horizontal speed? (llVecMag ( <Vel.x,Vel.y,0.0> ) I just do not know why you do not just get the last Z then the current Z every few seconds . A climb meter is not air flow meter. 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 5, 2019 Author Share Posted March 5, 2019 19 minutes ago, steph Arnott said: I just do not know why you do not just get the last Z then the current Z every few seconds . A climb meter is not air flow meter. How to do this? Please advise? Link to comment Share on other sites More sharing options...
steph Arnott Posted March 5, 2019 Share Posted March 5, 2019 (edited) 2 minutes ago, ainst Composer said: How to do this? Please advise? d = p1 - p2 s = d/t I could have wrote that in one line but there you go. Edited March 5, 2019 by steph Arnott 1 Link to comment Share on other sites More sharing options...
Qie Niangao Posted March 5, 2019 Share Posted March 5, 2019 I think we can simplify llVecMag(<0.0, 0.0, Vel.z>) to just plain ol' Vel.z ... and because we're already getting Vel anyway to calculate (horizontal) land speed there's no extra calculation involved. That said, it seems a lost opportunity to use a climb/dive gauge, instead of being able to watch the spinning hands of an altimeter as the aircraft plummets to earth. 😜 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted March 5, 2019 Share Posted March 5, 2019 1 minute ago, Qie Niangao said: That said, it seems a lost opportunity to use a climb/dive gauge, instead of being able to watch the spinning hands of an altimeter as the aircraft plummets to earth. 😜 Is that when the 'tune into next weeks episode' is announced? 1 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2019 Share Posted March 5, 2019 3 hours ago, Qie Niangao said: I think we can simplify llVecMag(<0.0, 0.0, Vel.z>) to just plain ol' Vel.z ... and because we're already getting Vel anyway to calculate (horizontal) land speed there's no extra calculation involved. That said, it seems a lost opportunity to use a climb/dive gauge, instead of being able to watch the spinning hands of an altimeter as the aircraft plummets to earth. 😜 Good point. I was recognizing that the OP is a beginning scripter, so I was trying to make it as simple as possible rather than going into a more involved (and probably more RL logical) way of doing things. 1 Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted March 5, 2019 Share Posted March 5, 2019 (edited) 4 hours ago, Qie Niangao said: That said, it seems a lost opportunity to use a climb/dive gauge, instead of being able to watch the spinning hands of an altimeter as the aircraft plummets to earth. 😜 You must be instrument rated. I'd be looking through the windshield.. and screaming. Edited March 5, 2019 by Madelaine McMasters 1 Link to comment Share on other sites More sharing options...
Qie Niangao Posted March 5, 2019 Share Posted March 5, 2019 Just now, Madelaine McMasters said: You must be instrument rated. I'd be looking through the windshield.. and screaming. Fly-By-Wire FTW 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted March 5, 2019 Share Posted March 5, 2019 3 minutes ago, Madelaine McMasters said: You must be instrument rated. I'd be looking through the windshield.. and screaming. Yep, definitely the hook for next weeks episode. Which some how turns out to be different from the last. You probably suddenly reveal you have wings and fly off. 1 Link to comment Share on other sites More sharing options...
ainst Composer Posted March 6, 2019 Author Share Posted March 6, 2019 (edited) 22 hours ago, Rolig Loon said: For measuring your vertical speed, yes. (Well, clean it up.) So i made it ... but it says Name not defined about Vel.z. How do i define Vel.z? SetInstruments() { if(llGetLinkName(instrument_link_number) != instrument_link_name) return; // we do this incase the links change float speed = ((llVecMag( <0.0,0.0, Vel.z>) * 1.94384) * speed_scale); //get the horizontal speed in knots and scale it based on what we set at the top of the script //Speed //////..... } Edited March 6, 2019 by ainst Composer Link to comment Share on other sites More sharing options...
steph Arnott Posted March 6, 2019 Share Posted March 6, 2019 8 minutes ago, ainst Composer said: So i made it ... but it says Name not defined about Vel.z. How do i define Vel.z? SetInstruments() { if(llGetLinkName(instrument_link_number) != instrument_link_name) return; // we do this incase the links change float speed = ((llVecMag( <0.0,0.0, Vel.z>) * 1.94384) * speed_scale); //get the horizontal speed in knots and scale it based on what we set at the top of the script //Speed //////..... } You did not use what Rolig stated vector Vel = llGetVel(); 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