[Opensim-dev] Questions about attachment point and offset
Tao YANG (GMAIL)
thomas.tao.yang at gmail.com
Tue Sep 30 08:55:10 UTC 2008
Hi Teravus,
Thank you very much for replying.
Attachment is a very important feature but it does not work well even in
latest revision of OpenSim.
I am curious and trying to do something to improve it.
Sorry, I think maybe I did not ask the questions very clearly.
Please let me explain again.
1,2,3 are concerning to attachment point
There are two places where attachment point is saved in recent source code.
(r6463)
One is saved in "avatarattachments" table in DB and there is no
corresponding data structure in memory.
The other is saved in "assets" table in DB, which is corresponding to
SceneObjectGroup.m_rootPart.Shape.State in memory.
When avatar logs in, the value of "attachpoint" field of "avatarattachments"
table will be used to indicate the attachment point if some prim of
inventory should be attached.
When avatar wears some prim, the value of
"SceneObjectGroup.m_rootPart.Shape.State" will be used.
I wonder why there exist two places to save the value of attachment point at
the same time.
4,5,6 are concerning to attachment offset
Yes, I can understand that many kinds of data could be saved in "data" filed
of "assets" table, that SceneObjectGroup.RootPart.Shape.PCode can
distinguish them.
What I am not sure is if SceneObjectGroup.RootPart.Shape.PCode ==
PCode.Prim, how to know whether it is being attached (being worn) or not.
Next is about the value of the offset.
In my opinion, after being attached to avatar or being taken to avatar's
inventory from grand, there should not remain the concept which directly
indicates the absolute position of an object(prim).
We can know the absolute position of it by the fomular which looks like the
following,
A = B + C + D
A: absolute position of an attached object
B: absolute position of the owner
C: offset of attachment point to the avatar
D: offset of prim to attachment point
(C and D could be combined)
So I guess,
if prim is being attached, SceneObjectGroup.AbsolutePosition is the offset
of attachment. ex. (-1.23463, 6.54345, -0.36323)
if prim is not being attached, SceneObjectGroup.AbsolutePosition should be
zero. ex. (0, 0, 0)
But I noticed that the value of "GroupPosition" is not (0, 0, 0) but the
absolute position in region even though the prim is not being attached.
And I could not see the attached prim on the screen sometime because
attachment point is not 0, but the value of offset is very large such as
(128.234, 130.6434, 21.4536) in some strange cases.
I wonder the concept and original design here.
Thanks
Thomas
2008/9/29 Teravus Ovares <teravus at gmail.com>
> 1. Shape.State is where the data is saved in the object itself. It's
> saved there because there are 'other things' that go there as well..
> like the Tree type. It also gets persisted. Attachment point is
> not. Do you want to keep picking the attachment point when wearing an
> item, or do you want it to remember?
>
> 2. ??
> 3. ??
> 4. Because you don't look at the asset table alone ever. You always
> look at it in the context of an inventory item. There could be many
> inventory items referring to the same asset. (but in practice this is
> rarely the case)
> 5. Yes. If you have it in SceneObjectGroup, there's actually a
> method to call to determine if it's an attachment for you.
> 6. Technically, you could pull out the asset data from the assets
> table, decode it, and search for prim with a State that is nonzero and
> a pcode = [to the enum value PCode.Prim]
>
>
> On 9/28/08, Tao YANG (GMAIL) <thomas.tao.yang at gmail.com> wrote:
> > Hi everyone,
> >
> > Could anyone kindly answer the following questions?
> >
> > 1. Why attachment point is saved in both "avatarattachments" table and
> > "SceneObjectGroup.m_rootPart.Shape.State" at the same time
> > 2. Why the one saved in "avatarattachments" table is used when avatar
> logs
> > in?
> > 3. Why the one saved in
> > "SceneObjectGroup.m_rootPart.Shape.State" when "wear"?
> >
> > 4. Why attachment offset is not saved in "avatarattachments" table
> > but "SceneObjectGroup.m_rootPart.GroupPosition", which
> > is converted to "X", "Y", "Z" sub-elements of "GroupPosition" element in
> the
> > "data" filed of "assets" table?
> > 5. Is "SceneObjectGroup.AbsolutePosition" used as
> > attachment offset when a prim is attached?
> > 6. If the anser of Q.5 is "YES", how to know whether the prim is attached
> or
> > not when reading "data" from "assets" table?
> >
> > Thanks in advance
> > Thomas
> >
> > _______________________________________________
> > Opensim-dev mailing list
> > Opensim-dev at lists.berlios.de
> > https://lists.berlios.de/mailman/listinfo/opensim-dev
> >
> >
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080930/e795fe12/attachment-0001.html>
More information about the Opensim-dev
mailing list