These forums are CLOSED. Please visit the new forums HERE
Help with a Simple Vector? ARG! |
|
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-29-2009 04:45
New code below.
|
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-29-2009 05:19
new code below
|
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-29-2009 05:27
its seems to be llGetLocal rot, that makes it increment over and over, insted of just once and throws it all out, but how else can I make it local
|
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-30-2009 03:07
Anyone?
|
Meade Paravane
Hedgehog
![]() Join date: 21 Nov 2006
Posts: 4,845
|
11-30-2009 08:02
/me is a bit confused.
If you're not messing with individual prims in a link set or with attachments, 'local' doesn't make sense. Can you try to sum up what you're trying to do again? What's the goal here? _____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224 - If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left |
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-30-2009 10:06
Ok lol
It's a 3D scanner, that I'm making 2D. I want the ball thats rezzed to just move on the LOCAL Y and Z axes and never move along the X axes. It is doing that. it should just display the persons Y and Z, so across and up. -- But it just moves over and over by an increment along the Z and Y axes and I don't know why. Heres the code now: vector newPos = (vector)newPosition; // this is the persons location. vector ourCurrentPositionY = llGetPos(); vector scaledDownPositionY = (newPos - ourCurrentPositionY) / (256 / 1); // returns how much to move the ball in each direction vector positionToMove = llGetPos() + (<0, scaledDownPositionY.y, scaledDownPositionY.z>*llGetRot()); // removes the X axes and makes it local(or so I want it to) llSetPos(positionToMove); llOwnerSay("position now at " + (string)llGetPos()); |
Meade Paravane
Hedgehog
![]() Join date: 21 Nov 2006
Posts: 4,845
|
11-30-2009 10:27
/me would have to poke at it in-world, which I can't do here at work..
I want the ball thats rezzed to just move on the LOCAL Y and Z axes and never move along the X axes. The world 'local' doesn't really mean anything unless you are talking about one prim in a linked object or about attachments. vector scaledDownPositionY = (newPos - ourCurrentPositionY) / (256 / 1); // returns how much to move the ball in each direction 256 / 1 will always (had better!) return 256. Do you want 1 / 256 there? vector positionToMove = llGetPos() + (<0, scaledDownPositionY.y, scaledDownPositionY.z>*llGetRot()); /me goes a little crosseyed. I hate Mondays. One thing I usually do when writing tricky code is to start by doing each step on a separate line - eating the cost of a bunch of extra variables and such - and poking at it until it works. Once it works via baby steps, I go back and clean it up. _____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224 - If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left |
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-30-2009 10:36
Would you be willing to have a look in world later?
I've been really struggling with this ![]() I just can't understand it at all. |
Meade Paravane
Hedgehog
![]() Join date: 21 Nov 2006
Posts: 4,845
|
11-30-2009 10:46
If I'm around, which isn't a done deal at all.
I think you're missing some part of this, though - more than needing to fix a line or 2 of code. If you're trying to do a 2D representation of a 3D space, I think you need to do more than just set .x to be some static value - you need to do some more-complicated math to map the 3D position to a 2D position. Some bit of math that takes 3 numbers and spits out 2 numbers. That sorta stuff really isn't my gig.. _____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224 - If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left |
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-30-2009 11:14
Yeah I hope it's not that hard Math.
The odd thing is it, it works, it goes to where it's ment to go, BUT then it carrys on incrementing by the same amount over and over when it's not supose to. |
Meade Paravane
Hedgehog
![]() Join date: 21 Nov 2006
Posts: 4,845
|
11-30-2009 11:27
/me points at http://en.wikipedia.org/wiki/3D_projection and runs away from this thread!
edit: but I guess you could get away from the scary (to me) math if you really only cared about 2 of the 3 position parts. What are you trying to show with your radar? If you really didn't care about, for example, the mapee's height, it would be a lot easier - that'd just be scaling the x & y values down. _____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224 - If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left |
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
11-30-2009 11:32
Arg, the thing is, I know someone else who's done this, but they don't play anymore
There by no means a Math person, and I just can't see them of doing it a way that's so difficult. Mines almost doing it, it does the correct thing, but then does it again?? over and over |
Void Singer
Int vSelf = Sing(void);
![]() Join date: 24 Sep 2005
Posts: 6,973
|
11-30-2009 16:25
scaling it's hard, although I think changing the axis is what's got you thrown...
sim scale is 1:1 (or 256:1 depending on how you look at it) your model base will be divide by this number, (for ease we'll us a 2m square base) get the inworld position of your target object.... lets say it's at 64x/64y/100z ( vLoc = <64.0, 64.0, 100.0> now the math to traslate that to your model base is base size (2m) / range(here sim size of 256) - (model base / 2). subtracting half the model base is done because local offsets are from the center of the model base not the edge vLoc.x = 2.0 / vLoc.x - 1; vLoc.y = 2.0 / vLoc.x - 1; we don't care about height so just preset a local height above the map you want vLoc.z = 0.0; //-- all depends on the thickness of your map vLoc now holds a local offset from your model of that represents the inworld object/av position now if you build it flat like this to begin with you can mount it any way you choose (including on a wall), and to translate the new positions, you can simply multiply vLoc * llGetRootRotation() to get the corrected position alternatively you could have swapped the positions in the vector of x and y with y and z, but it limits your options for display. _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |