Jump to content

Search the Community

Showing results for tags 'coordinates'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • People Forum
    • Your Avatar
    • Make Friends
    • Lifestyles and Relationships
    • Role Play
    • General Discussion Forum
    • Forums Feedback
    • Missed Connections
    • Second Life Education
  • Places and Events Forum
    • Favorite Destinations
    • Upcoming Events and Activities
    • Games in Second Life
  • Official Contests & Events
    • Leap Into Love Snapshot Contest
  • Creation Forum
    • Fashion
    • Art, Music and Photography
    • Animation Forum
    • Bakes on Mesh
    • Environmental Enhancement Project
    • Machinima Forum
    • Building and Texturing Forum
    • Mesh
    • LSL Scripting
    • LSL Library
    • Experience Tools Forum
    • Sansar for Second Life Residents
  • Technology Forum
    • Second Life Server
    • Second Life Viewer
    • Second Life Web
    • General Second Life Tech Discussion
  • Commerce Forum
    • Merchants
    • Inworld Employment
    • Wanted
  • Land Forum
    • General Discussion
    • Mainland
    • Linden Homes
    • Regions for Sale: Full Private Island
    • Region for Rent: Full Private Island
    • Regions for Sale: Homesteads
    • Region Rentals: Homestead
    • Parcels for Sale: Mainland
    • Parcels for Rent: Mainland
    • Wanted: Full Private Island
    • Wanted: Homesteads
    • Wanted: Mainland
  • International Forum
    • Deutsches Forum
    • Foro en español
    • Forum in italiano
    • Forum français
    • 日本語フォーラム
    • 한국어 포럼
    • Fórum em português
    • Forum polskie
    • المنتدى العربي
    • Türkçe Forum
    • Форум по-русски
  • Adult Content Forum
    • Highlight Upcoming Events
    • General Discussion
    • General Announcements
  • Answers
    • Abuse and Griefing
    • Account
    • Avatar
    • Creation
    • Inventory
    • Getting Started
    • Controls
    • Land
    • Linden Dollars (L$)
    • Shopping
    • Technical
    • Viewers
    • Everything Else
    • International Answers

Blogs

  • Commerce
  • Featured News
  • Inworld
  • Tools and Technology
  • Tips and Tricks
  • Land
  • Community News

Categories

  • English
  • Deutsch
  • Français
  • Español
  • Português
  • 日本語
  • Italiano
  • Pусский
  • Türkçe

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 3 results

  1. i think i figured out what i'm doing wrong. i am trying to calculate the angle of a slope between two points. point 1 = the spot directly below the avatar where it is standing. (in region coordinates) point 2 = the spot the ray intersects the ground ahead of the avatar. (in region coordinates, translated from the avatar's local forward axis) and i have this formula: angle = RAD_TO_DEG*( llAtan2( (p2.z - p1.z),(p2.x - p1.x) )); i THINK the problem is, that i'm just using the X and Z coordinates, and not correcting for the Y coordinate, if the avatar is not facing along the global X axis. so i found this: https://www.euclideanspace.com/maths/geometry/elements/projections/index.htm how to project a point (my target hit with x,y coordinates) onto a line (the global x axis). um... okay, so i have to take the line that is the avatar's facing, project a line at a right angle to that line from the point, and find out where it hits the X axis. uh... yeah, i dunno how to do that :/ except by drawing on graph paper! :X drawing: https://prnt.sc/onjtdl okay, i worked THIS out: http://prntscr.com/onk6ao if i can just get the x/y plane distance of a, then calculate the x/y coordinate of 2a along the avatar facing... THAT x coordinate should be the one i need. and i don't need to mess around with all those pythagorean thingies. what's the 2d version of llVecDist? oh, set the Zs to 0 first... okay, i came up with this, and it returns total BS. it even returns different answers if i click it (activate the calculation by touch) multiple times, without moving in between. float getSlope() { float ht = 0.75; //--normally a calculated global. vector pos = llGetPos(); //--we know where the floor is, cuz we're standing on it @ -ht. vector target = pos; rotation rot = llGetRot(); target = pos + <3.*ht,0.,0.> *rot;//-- test 3 ahead and 2.5 down target.z = target.z - 2.5*ht; // llOwnerSay("Aiming "+(string)pos+" to "+(string)target); list res2 = llCastRay(pos, target, [RC_REJECT_TYPES, RC_REJECT_AGENTS | RC_REJECT_PHYSICAL, //RC_DATA_FLAGS, RC_GET_NORMAL, RC_MAX_HITS, 1]); llOwnerSay("RC returned:"+llDumpList2String(res2, ",")); float angle; if(llList2Integer(res2, -1) != 0) { vector p1 = pos; vector p2 = llList2Vector(res2, 1); //--calculate X without Y vector xy1 = p1; vector xy2 = p2; xy1.z = 0.0; //--get rid of Z influence xy2.z = 0.0; float dist = llVecDist(xy1,xy2); vector xTarget = pos + <2*dist, 0., 0.> * rot; //--SLOPE: p1.z -= ht; //--make this the floor p1.x = xTarget.x; //--make this our actual distance along avatar FWD angle = RAD_TO_DEG*( llAtan2( (p2.z - p1.z),(p2.x - p1.x) )); } else //--we didn't hit anything, the slope is WAY down. angle = -45.0; //--midway to down. fudged. if(angle > 90.0) angle -= 180.0; else if (angle < -90.0) angle += 180.0; return angle; } and no, i don't know how to do angle math, either :X
  2. i know i know how to do this... sorta. but i can't seem to figure it out. okay, i'm trying to ray cast from an attachment, and i want to get the spot straight down from the center of my avatar (easy, thats llGetPos and lower the z coordinate), and "ahead" of my avatar. which i know is local pos + x, BUT... to get that in region coordinates, compared to which way my avatar is facing, i need to use (i think??) Rot2Fwd. i'm just... not sure where/how? vector fwd = llRot2Fwd( llGetLocalRot() ); vector targetPos = llGetPos() + (fwd* ht); this is from the example on the wiki page... http://wiki.secondlife.com/wiki/LlRot2Fwd it says 'to move an object 5 meters on its forward axis.' in this case i'm moving it "ht" meters on its X axis. or... not MOVING it, but getting a coordinate that is supposed to be ht meters ahead of where i am. but when i face the Y axis... i'm not getting a change in the Y axis calculation? :/ no. i changed 'ht' to 10 meters, but only the x coordinate is ever changing. it's been a long day...
  3. Hi fellow scripters and builders! I'm working on a control HUD to one of my upcoming projects, and I've kind of hit a dead end thanks to my insufficient trigonometry. What I need is the following: I've got a face on the HUD. It's middle point represents a pivot. The HUD wearer can click the face, and I need to be able to get the angle (calculated from the "upwards" Z axis) from that. The click provides coordinates in the form of a vector <u,v,0> where U is the horizontal coord, V is the vertical coord, and they both are a range from 0.0 to 1.0 - using function llDetectedTouchUV() I'm attaching a visualization of what I have in mind. I'm sure this is a trivial problem, but for someone who had long forgotten everything about trigonometry, it's a total blocker. Thank you to whoever will be able to help me out! ♥
×
×
  • Create New...