Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

RezObject with the same rotations as the parent

Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
09-08-2004 09:20
Can someone help me out here, please? I have a cannister and I'd like a light beam to rez from it on command.

I have the cannister and the light beam, and can rez it on command, but I can't seem to get the light beam to match the angle/rotation of the canister, which will be changing every so often.

How do I get the rezzed object's coordinates and angle to match the rezzing object's?
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-08-2004 09:26
why not just link it to the light and change the beams texture or alpha.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
09-08-2004 09:29
Cause there will be dozens of them and I want to rez them (the light beams) as temporary objects so they don't affect prim count.




I've got the beam to appear at the right angle using this code:


touch_start(integer total_number)
{
rotation GlobalRot = llGetRot();
llRezObject("Light Beam", llGetPos() + <0, 0, -2>, ZERO_VECTOR, GlobalRot, 42);
}


But it's a meter or so away from the center of the canister that should be beaming it.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
09-08-2004 09:32
In the call to rez object, the rotation should be llGetRot(). If you need to give the beam some base rotation then it's llGetRot() * rBeamRot

And the position should be
llGetPos() + (vOffset * llGetRot()) [or llGetRot() * vOffset, I can never remember, it's the one that compiles].

Where vOffset is the vector from the center of the canister to the center of the beam (when the rotation of both is 0).

Simple eh?
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-08-2004 09:38
I was thinking that Aaron wanted to move them as well as just rez them which is a bit more work. It can be done but it's a bit of a pain.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
09-08-2004 10:36
If you want to keep it simple, how about this:


Make a tiny prim and position it so that it is at the same location and rotation as the can.

Link it to the beam, making sure that it is the root.

Get the llGetGeometricCenter of the new beam.

Now passing the can's position plus the "center" result, and the can's rotation (unaltered) should always rez the beam in the right place and angle.


But what Wednesday said does work, in most cases.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
09-08-2004 10:45
From: someone
Originally posted by Wednesday Grimm
In the call to rez object, the rotation should be llGetRot(). If you need to give the beam some base rotation then it's llGetRot() * rBeamRot

And the position should be
llGetPos() + (vOffset * llGetRot()) [or llGetRot() * vOffset, I can never remember, it's the one that compiles].

Where vOffset is the vector from the center of the canister to the center of the beam (when the rotation of both is 0).

Simple eh?



I can't get either to compile. On one I get a type mismatch, on the other I just get a syntax error.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-08-2004 10:51
llGetPos() + (vOffset * llGetRot())

but you need to define a vector called vOffset.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
09-08-2004 10:56
From: someone
Originally posted by Tiger Crossing
But what Wednesday said does work, in most cases.

If I didn't like the sarcasm meter so much, I would have a new sig line ;)
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
09-08-2004 10:56
From: someone
Originally posted by Strife Onizuka
llGetPos() + (vOffset * llGetRot())

but you need to define a vector called vOffset.



Duh, I was defining vOffset as an integer. Thanks Strife!