Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
I have a boat that I extensively use to travel around in. When laying anchor, I rez a small tent, a table and a bunk, basically turning the moveable thing to a temporary stationary camper.
The objects are not linked, but rezzed from the boat, so I don't have to bother with adjusting the parts, as I would if I dragged them from inventory.
However, unless the root prim is not aligned 0,0,0, the rezzing becomes a bit skewered or off-kilter, positionwise. If the root prim is in the basic position it works just fine.
The code I use for this is:
default
{
listen(integer channel, string name, key id, string msg)
{
if (msg == "tent")
{
llRezObject("tent", llGetPos() + <2.458, 2.01, 0.834>*llGetRootRotation(), <0,0,0>, llGetRootRotation(), 600);
}
}
}
(Code not complete, just showing the relevant part).
Does anyone know if there is a way to remedy this, or if it is just a simple fact of life, a.k.a. limits of SL physics?
Hmm. I've never heard of that to be honest. Skewed or off-kilter in what sort of way - incorrect rotation?
llRezObject("ObjectName", llGetPos() + <0.0,0.0,5.0>, ZERO_VECTOR, llGetRot(), 0);
This will rez the object directly above the prim calling the function, 5m up. This will give proper position and rotation to the object rezzed, though if you rez while moving, exact position/rotation might be off a little before the rezzed prims stop the boat's physics by intersecting non-physical objects. It is my experience that you will have approximately a 95% accuracy with that function called as exampled above. :)
Well, aligned in relation to the boat (in this case). The root prim of the boat, when I built it and also added the things, had a rotation of 0,0,0. As long as the boat has that rotation, the tent is rezzed aligned with the boat.
Any other rotation of the boat, e.g. 0,0,68, the tent will be rezzed misaligned, too much forward (y axis) and to the left (x axis). It is still in line with the boat itself in such way that the relative fore-aft direction is correct.
To illustrate, I uploaded some pictures on Flickr.
It is the same with every vehicle that I use the script with, so it's not an isolated event. (More like an isolated/specific script, perhaps)
Thanks Burnman, I will try that right away! :)
I have the tendency to lay anchor before rezzing anything anyway, so that should be no problem.
Worked like a charm. Just what I was looking for.
I took this particular line from an example once. One thing I never understood was what the 600 was for, though. Anyone knows?
llRezObject("ObjectName", llGetPos() + <0.0, 0.0, 0.0>*llGetRootRotation(), <0,0,0>, llGetRootRotation(), 600);
The 600 is a parameter passed to the rezzed object. The on_rez(integer n) event gets that number as n, or 0 if it is rezzed directly from inventory by dragging. It is convenient to use this for some purposes... I usually have bullets set to disable their functions if rezzed with parameter 0 for instance, so that I can drop them on the ground to fix them without them exploding, and it is often handy for passing a channel for the object to listen on for further instructions.
I suspect your issue is with llGetRootRotation vs llGetRot. The table should be rezzing with a position appropriate to the boat's rotation, rather than the rotation of the root prim. Perhaps llGetRootRotation returns relative rotation of the root prim to the whole object's rotation. I shall check.
Hm. Is this script in a child prim?
Your problem is llRezObject. Always use llRezAtRoot. RezObject rezzes from some funky location that's not actually the root's position.
llRezObject will spawn the object in relation to the prim it is called from.
While true, it does cause funky results in some situations, particularly attachments. I usually go out of my way to rez stuff only from the root prim in most cases anyway. :3
Thanks for the information on on_rez(integer n), Miss Malaprop. Quite handy to know.
No, the script is in the root prim. Since I often use this script in my private builds, I am going to do a couple of testruns with various versions (llRezObject vs llRezAtRoot, etc) under various circumstances, during this discussion. I'll be sure to post the results here.
This does sound like some sort of odd bug. llGetRootRotation should always return the same value as llGetRot in the root prim, but you say that using llGetRot fixed the problem... perhaps it is one of those ones which only appears when functions are used in combination with each other.
Posted By: Tyken HightowerWhile true, it does cause funky results in some situations, particularly attachments. I usually go out of my way to rez stuff only from the root prim in most cases anyway. :3
Hmmm, I've never tried calling it from an attachment... I'll have to play around with it and see what happens! :) Thanks for the heads up, I love testing things like this... lol
1 to 15 of 15