Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezzing in relation to attached child prims?

Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-02-2006 04:59
I have an attached object, and in that object is a child prim which is meant to rez projectiles.
However, I'm struggling to get it to fire these projectiles in the correct direction.

The objects should fire in the Z direction, the same direction as the particles that are creating the firing effect, however they are firing at all different angles which is confusing, I've tried all the different combinations of rotation functions that I can think off but I'm still having no luck =(

The function looked like (and worked fine in a non-attached root-prim):

CODE
llRezAtRoot("Object", llGetPos() + (<0.0, 0.0, 0.2> * llGetLocalRot()), (<0.0, 0.0, 10.0> * llGetLocalRot()), ZERO_ROTATION, channel);


I hate rotations so much :(
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-02-2006 14:36
Am I missing something completely with this? I've now moved the script to a specially placed root prim but it won't fire in the correct direction either, there's also no apparent consistency to it, sometimes it fires off at odd angles, others it seems to fire in terms of global co-ordinates (ie it always fires West) despite being (supposedly) relative to the avatar's rotation by using llGetRootRotation().

Oh, which I didn't not in my original post, I swapped llGetLocalRot() for a variable which calculated llGetRootRotation() * llGetLocalRot() but still no apparent avail :(
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
06-02-2006 15:11
is the rezzing script in a child prim of the attachment? The fact that it works in world but not attached makes me think it's the fact that the AV is now the root prim. Try changing from llRezAtRoot to llRezObject?
_____________________
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-03-2006 12:12
Okay, I've figured out why it shooting straight up using llGetRootRotation() * llGetLocalRot(), I needed to turn it into a direction vector (in this case llRot2Up()).

However, the rotations aren't combining as I want, so far example we have these two:

RootRotation (avatar): <0.0, 0.0, 110.0>
LocalRotation (attachment): <0.0, 60.0, 0.0>

RootRotation is perfect, that's the direction my avatar is facing
LocalRotation is correct in that the 60º angle is how far it is DOWN from the topside of my avatar (ie if it were 0.0 it would point straight up, 60.0 points 60º down from that in the forward direction).

What I now am trying to do is to get these to combine these so that the projectile can be fired from the attachment in the direction that it is facing.

llRot2Up(llGetRootRotation() * llGetLocalRot()) does not do this, it gives a rotation of <0.0, 60.0, 110.0>, which is not the correct angle, as rezzing a cube with those values causes it to point in the wrong direction :(

Rotations are so damned confusing.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
06-03-2006 12:30
From: Haravikk Mistral
Rotations are so damned confusing.

Rotations must normally be performed in certain order (because for quaternions a * b doesn't equal b * a) ... so you might want to see if reversing the order helps anything o.O;
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-04-2006 04:36
Hmm, doesn't seem to be that, tried a combination of using additions and subtractions as well. I think the problem with using llGetLocalPos() is that it's not using the same axis as the avatar, ie, rotating the avatar 60º in the y-axis moves it back 60º from forward, while the attachment is down 60º from up (if that makes sense?).

Anyway, ignoring that, it seems as though llGetRootRotation() isn't returning correct results either, turning the avatar while it is firing causes shots to fire off too far in the direction I was turning. e.g I turn from 25º left, the shots fire 30º left, as though the rotation is based on my camera position (you'll notice when turning that the avatar doesn't face the direction you're looking until you start moving forward, it kinda just stands at a slight angle and LOOKS in the correct direction. This isn't ideal as the projectiles aren't being fired from the head.

Which would seem to suggest that I need to find the rotation for the attachment point I'm on in relation to the avatar (ie after turning the avatar is at <0.0, 0.0, 90.0> but the stomach is at <0.0, 0.0, 85.0>;). This just gets more and more infuriating, bah, has no-one tried to do what I'm doing and succeeded, or found some results that may help?

It seems to not be rotation as such, it seems I'm actually doing all of that just fine, it's the bloody issue of it being an attachment that's causing all this spackiness :(
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-04-2006 04:41
Wait, ignore that part, seems that llGetRot() returns a more accurate rotation than llGetRootRotation(), still need to work on using the attachment's angle to fine tune it somehow, but that oddity is done with at least :)
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)