RezObject with proper rotation?
|
Gabrielle Assia
Mostly Ignorant
Join date: 22 Jun 2005
Posts: 262
|
09-13-2005 09:50
I'm trying to get a box set up with a script that will rez two items from it's inventory. Done with llRezObject, exept one of the items being rezzed has its X rotation set to 180, and the other has <0,0,0> It seems there might be a couple possible ways to do this, but what is the best way? Thanks, Gabrielle PS. (other items could be placed in the box that have any other rotation value, so really the script needs to rez the object with it's proper rotation - if that wasn't obvious)
|
Michael Martinez
Don't poke me!
Join date: 28 Jul 2004
Posts: 515
|
09-13-2005 10:05
You can get the rotation from the box (say the llGetRot and copy that exact into the rez object) so you know exactly what to put in the rez object rotation to get to rez at the right rotation...
or make it so the box itself will right itself on rez to the proper rotation, again taken from the saying of llGetRot when it is in the right position.
|
Gabrielle Assia
Mostly Ignorant
Join date: 22 Jun 2005
Posts: 262
|
09-13-2005 14:04
From: Michael Martinez You can get the rotation from the box (say the llGetRot and copy that exact into the rez object) so you know exactly what to put in the rez object rotation to get to rez at the right rotation... or make it so the box itself will right itself on rez to the proper rotation, again taken from the saying of llGetRot when it is in the right position. Thanks Michael, but I'm not sure I follow you, or maybe that's not the solution I'm looking for. If you are suggesting that I manually find the rotation and hard code that in to some script, then no.. that's not what I want... I want the object rotated auto. It's my understanding that llGetRot only returns the current rotation (after it's been rezzed), so I'm not sure how that would help me. I guess llGetPrimitiveParams might be able to do something? But how does the code look that would make sure the object rezzed to the proper rotation. I guess I find it odd to have to go to all this trouble, and possibly put a script in the items being rezzed to make sure it's rezzed with it's proper rotation. it seems like there would be an option to llRezObject where you would not have to hard set the rotation, but rather let the rezzing item use it's default rotation. Maybe I'm missing something? Perhaps there are other ways to accomplish the same thing without having to put a script in the rezzing object? thanks, Gabrielle
|
Gabrielle Assia
Mostly Ignorant
Join date: 22 Jun 2005
Posts: 262
|
09-13-2005 16:45
Thanks to Gaz Hornpipe who answered this in-world. His EASY solution was not script related, but so helpful, maybe other newbies could use it: Gaz Hornpipe: The way Hiro did it was to have a clear prim that you attach your real object to. So you rotate your real object how you want it, then attach it to the zero-rotated holo prim.
|
Zeno Concord
To infinity, and beyond!
Join date: 28 Mar 2005
Posts: 51
|
why is rotation so hard?
09-13-2005 18:13
From: Gabrielle Assia it seems like there would be an option to llRezObject where you would not have to hard set the rotation, but rather let the rezzing item use it's default rotation.
I agree 100% with that. There are times when you do want to change the rotation when you are rezzing an object (say you are rezzing a fly onto the surface of a wall or ceiling), but usually you want the same rotation it had when you put the object in. Why should the rotation be treated so differently from the scale? The object remembers its scale when you rez it, so why should it not be able to remember its rotation? On the other hand, if you want an object to change the scale of another object when it is rezzed, you cannot do that. You have to arrange to tell the object itself to change its own scale after it has been rezzed. I am working on a vendor that, after it rezzes an object, you can rotate it, move it around, and scale it, and these changes will be reported back to the vendor so that the next time you rez the object, it will be put back the same way. This happens automatically, but there is one necessary inconvenience: in order to make the record permanent (so it survives resets), the user must edit a notecard to copy-paste in the numbers. That will be fixed as soon as there is a way to write data persistently.
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
09-14-2005 03:44
Gabrielle: Are you using the fourth parameter of llRezObject? It is there do exactly this. ZERO_ROTATION will give you <0, 0, 0> but to get 180deg around X, remember that 180degrees is PI radians, so <PI, 0, 0> is what you want. convert it to a rotation using llEuler2Rot llRezObject("item 1", llGetPos() + <1, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, 0); llRezObject("item 2", llGetPos() + <1, 0, 0>, ZERO_VECTOR, llEuler2Rot(<PI, 0, 0>), 0); Does that help, or are you having problems with the rotation being relative to the box? (or am I just mis-understanding completely?)
|
Gabrielle Assia
Mostly Ignorant
Join date: 22 Jun 2005
Posts: 262
|
09-14-2005 08:49
From: Ben Bacon Gabrielle: Are you using the fourth parameter of llRezObject? It is there do exactly this. ZERO_ROTATION will give you <0, 0, 0> but to get 180deg around X, remember that 180degrees is PI radians, so <PI, 0, 0> is what you want. convert it to a rotation using llEuler2Rot thank Ben. My problem has been solved, but no, this does not solve my problem. The problem is that there are several objects being rezzed by a master object. Some of the objects being rezzed have all kinds of different rotations, so I want the master object to just rez each item using the rotation values given for each object. It seems silly that llRezObject can be given many parameters as to how to rez an object, but we can't just let the object being rezzed use it's own default rotation. How about giving llRezObject that ability, when someone uses "-1" at the value of the 4th param?
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
09-14-2005 09:28
There are a couple of ways you could address this.
If you're going to know the rotations in advance you could hard code them in. Never fun, but doable. Alternatively I think you can do it with a script in each object that you use some mechanism (e.g. a touch event) to measure it's final rotation before you put it in the inventory, and then an on_rez() rotate it to the desired position.
Neither are quite what you want, I agree, but there are uses for the system as it is. If you really, really want to try then either the hotline, or to save you their typical reply, start a vote for a 'default rotation' rot - something that we could all plug into the code.
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
09-15-2005 02:32
I'm speaking out of ignorance here, as I don't know them internals of SL, but my educated guess is that objects don't have a default orientation? I will only be able to get in-world in about 8 hours, so could someone try this. Create an object. Copy it. Rotate the copy. Take both. Now just rez them as you normally would. Do they remember their rots, or are they now world aligned? In many graphics apps, shape and size are intrinsic properties of an image/object, but position and rotation are not. If I change the shape of my car, or, say, its colour, then I have changed my car - but if I move it somewhere else, or make it face a different direction, then the car has not changed. Zeno's vendor idea is great, and you could also make each object itself remember its pos+rot in other contexts. Now if we could just get the ability to have the vendor write these values to a note.... that would be cool 
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
09-15-2005 03:36
They do remember their rotation when you take them into your inventory, even when you accidentally delete them and then rerez them via the trash.
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
09-15-2005 04:03
From: Eloise Pasteur They do remember their rotation when you take them into your inventory ... Thanks, El. In that case, Gabrielle's request for default rotation, or something similar, would seem to make a lot of sense.
|