Search the Community
Showing results for tags 'math'.
Found 4 results
so on my slope quest... i have two coordinates, one that is right below my avatar, and one that is about 2 meters ahead of it. these are raycast coordinates, shooting out from the avatar's center point. anyway, i have gotten the formula that the angle of the slope is Tan^-1 (slope). and slope = (z2 - z1)/ (x2 - x1). vector p1 = llList2Vector(res1, 1); vector p2 = llList2Vector(res2, 1); float angle = llPow(llTan( (p2.z - p1.z)/(p2.x - p1.x) ), -1); so tangent of the slope to the -1 power. i'm standing on a prim rotated at 45 degrees, and facing upslope. but the angle keeps coming out to tiny numbers like -0.41267. eh??? my brain is melted. https://www.quora.com/How-can-you-find-the-angle-of-line-by-using-its-slope if you're nuts, these are some of the readouts i got: yeah, i tried getting the normals, but... i don't think i can wrangle those into anything useful for my purposes. i'm trying to see if the avatar is walking up or down a slope, and how steep it is. the normal just gives me the angle of the prim surface, not any idea of which way im facing on it.
All right, so I have discovered a behaviour I can't quite understand when uploading mesh models. First off, I created two models for testing, one is basically a smaller version of the other, made with the same tools and workflow. Here is what I get for trying to upload the small model: Looks about right, 0.649 Download impact for 1501 Vertices, I can live with that. (I've turned down LODs for this example to make sure they don't influence the calculation) Next off, here is the bigger version... Woops, now that can't be right. I've gone up from 1501 Vertices to 7239, so the model increased in complexity by ~4.82 times. The download impact however seems to have increased from 0.649 to 18.579, so by ~28.63 times (!). I don't know the exact formular of how SL calculates this number, however this seems too extreme of a difference to be correct. For another example, the source .dae file of the small model is 219.616 Bytes in size (measured from windows properties panel), the file of the big model is 1.053.387 Bytes, which is an increase of ~4.8 times, roughly matching the increase of vertices between the models. Since downloading a file is literally just pushing the bytes of the model over the network I can not understand this unreasonable increase in Download Impact, but then again this is my first upload where I actually pay attention to these numbers, so maybe I'm just missing something obvious here. I hope someone can help me clear this up, thanks in advance for that! Best regards Jack
Hey, so this is a question to the more experienced math scripters in sl. I understand the principles of trig in math, I understand that to work out say angle X in a triangle where we are given the adjacent value of 3.5 and the opposite value of 2.1 we would use the TAN=OPP/ADJ formula etc etc. However, I am struggling a little in putting this into practice in lsl. I was trying to apply this knowledge by firing out an object but determining the angle of fire by the distance (lets use the above example and say this is the adjacent) it needs to travel and the height (lets say this is the opposite) of the target it needs to hit. So in theory this should be : Angle of fire = TAN^-1(Distance/height)....if we assume that I'm using the TAN=OPP/ADJ formula I will be honest I'm struggling to visualise this in a 3D space using lsl coding, could one of you give me a basic example of how this would work, especially if I am way off base here, with some kind of notation included to explain the method. I am really trying to improve my use of math in lsl but I am struggling a little to visualise this in a 3D environment given the lsl functions
Hello! I'm pretty new to scripting, in which I mean that I don't know how to at all, lol! I would however like some help learning, or figuring out if there's a script that already exists that I need. So, some friends and I are starting just a mini rp-sim kinda thing that's very loosely based on D&D in which it uses dice rolls, a grid system, and a bit of math to add or subtract health from either players or monsters that they're fighting. Since a lot of them have lower-end PCs the traditional fighting and battle huds won't work for us, since a lot of them require your character to physically move around and attack/hit other players with certain weapons and whatnot. A lot of time some of them lag a lot more than others who have higher end PCs, so it makes the fighting unfair and not very fun. I've been trying for a while to figure out how to make a HUD, or a script that when you click on object you're wearing it'll bring up a menu and do the following: Set a base HP amount, so when you level up your HP can be increased. Type in an amount to either add or subtract from your HP and it'll automatically do the math and show above your head, or the monster's head. So like "42/100 HP" I'm just not sure where to start with all of that, and I've been looking for about an hour or more. Any help or advice would be greatly appreciated!!