Jump to content

Judy Hynes

Resident
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Judy Hynes

  1. Just saw this correction. I used the original solution (sin) and it worked fine. The angles I need to use are indeed small (around 1 degree) so I guess that switching to the "correct" solution won't look much different. I made a visualizer that would rez objects at regular intervals along the path to see the "fan out" effect at 5m, 10m, 15m, etc. and it looked like what I wanted.
  2. Great, this is just what I needed to understand. Thanks so much for the help! I think I'm going to go with the solution suggested by Rolig. The trigonometry of how to find the end point just makes more sense to me that way. I'm afraid I still get lost in trying to understand how to apply rotations correctly.
  3. I got stuck trying to figure out how to orient rays so I thought I'd ask about the math here. What I want to do is use llCastRay to generate several rays all emanating from the same point but at different angles. These will be in a script attached to an avatar, so everything will be relative to the avatar's rotation. I know how to make a ray go straight out in the direction the avatar is facing: float ray_range = 100.0; vector ray_start = llGetPos(); vector ray_end = ray_start + <ray_range, 0.0, 0.0>*llGetRot(); list ray_results = llCastRay(ray_start, ray_end, []); And I know how to make other rays that are parallel to but offset from the center ray: float ray_range = 100.0; float left_shift = 2.0; // this ray will be parallel to center ray from before but 2m left and 3m up from it float up_shift = 3.0; vector ray_start = llGetPos() + <0.0, left_shift, up_shift>*llGetRot(); vector ray_end = ray_start + <ray_range, 0.0, 0.0>*llGetRot(); list ray_result = llCastRay(ray_start, ray_end, []); But I'm struggling with how to make a ray that's for example pointing 5 degrees to the right of the center ray, or pointing 2 degrees up from it. My example above is easy because the rotation is not adjusted (all rays are parallel so the rotation doesn't change) but I'm not sure how to modify that rotation with an angle offset.
  4. Yup, it all makes much more sense now. Having success with this technique now. Thanks for the help!
  5. Thanks for the reply. This makes more sense now. One follow-up on the example you gave. You wrote: list left_rod = [MyPosition+ToMyLeft, 10*InFrontOfMe+ToMyLeft]; But ToMyLeft already has MyPosition added to it. So if I put your example all in one line it looks like this: list left_rod = [MyPosition+MyPosition+<0,1,0>*MyRot, 10*(MyPosition+<1,0,0>*MyRot)+MyPosition+<0,1,0>*MyRot]; Is this really correct that the starting point has MyPosition added twice? It feels like ToMyLeft has already done that addition.
  6. I imagine this problem has been discussed here before but I couldn't seem to hit on the right search terms to use. So I apologize in advance if it has been covered. I have a script where I need to figure out the position vector (in global coordinates) of a position a fixed distance to the left or right of the avatar based on its current rotation. So for example consider this code: rotation rot = llGetRot(); vector start = llGetPos(); vector end = start + <100.0,0.0,0.0>*rot; This will give me a start position where avatar is and end position that's 100 meters straight ahead of where the avatar is facing. It's like a pole sticking out from avatar's chest. Now let's say I want the same thing that's 1 meter to the left. That is, I want to know the start and end positions of a "pole" that's parallel to the original one and shifted over 1 meter to the avatar's left. How can I calculate the start and end points? Sorry if the answer is obvious but doing vector and rotation math always makes my head hurt.
×
×
  • Create New...