<div dir="ltr">Hi Teravus,<br><br>Thank you very much for replying.<br><br>Attachment is a very important feature but it does not work well even in latest revision of OpenSim.<br>I am curious and trying to do something to improve it.<br>
<br>Sorry, I think maybe I did not ask the questions very clearly.<br>Please let me explain again.<br><br>1,2,3 are concerning to attachment point<br>There are two places where attachment point is saved in recent source code. (r6463)<br>
One is saved in "avatarattachments" table in DB and there is no corresponding data structure in memory.<br>The other is saved in "assets" table in DB, which is corresponding to SceneObjectGroup.m_rootPart.Shape.State in memory.<br>
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.<br>When avatar wears some prim, the value of "SceneObjectGroup.m_rootPart.Shape.State" will be used.<br>
I wonder why there exist two places to save the value of attachment point at the same time.<br><br>4,5,6 are concerning to attachment offset<br>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.<br>
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.<br><br>Next is about the value of the offset.<br>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).<br>
We can know the absolute position of it by the fomular which looks like the following,<br>A = B + C + D<br>A: absolute position of an attached object<br>B: absolute position of the owner<br>C: offset of attachment point to the avatar<br>
D: offset of prim to attachment point<br>(C and D could be combined)<br>So I guess,<br>  if prim is being attached, SceneObjectGroup.AbsolutePosition is the offset of attachment.  ex. (-1.23463, 6.54345, -0.36323)<br>  if prim is not being attached, SceneObjectGroup.AbsolutePosition should be zero. ex. (0, 0, 0)<br>
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.<br>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.<br>
<br>I wonder the concept and original design here.<br><br>Thanks<br>Thomas<br><br><div class="gmail_quote">2008/9/29 Teravus Ovares <span dir="ltr"><<a href="mailto:teravus@gmail.com">teravus@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">1.  Shape.State is where the data is saved in the object itself.  It's<br>
saved there because there are 'other things' that go there as well..<br>
like the Tree type.  It also gets persisted.   Attachment point is<br>
not.  Do you want to keep picking the attachment point when wearing an<br>
item, or do you want it to remember?<br>
<br>
2. ??<br>
3. ??<br>
4. Because you don't look at the asset table alone ever.   You always<br>
look at it in the context of an inventory item.   There could be many<br>
inventory items referring to the same asset. (but in practice this is<br>
rarely the case)<br>
5.  Yes.  If you have it in SceneObjectGroup, there's actually a<br>
method to call to determine if it's an attachment for you.<br>
6.  Technically, you could pull out the asset data from the assets<br>
table, decode it, and search for prim with a State that is nonzero and<br>
a pcode = [to the enum value PCode.Prim]<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
On 9/28/08, Tao YANG (GMAIL) <<a href="mailto:thomas.tao.yang@gmail.com">thomas.tao.yang@gmail.com</a>> wrote:<br>
> Hi everyone,<br>
><br>
> Could anyone kindly answer the following questions?<br>
><br>
> 1. Why attachment point is saved in both "avatarattachments" table and<br>
> "SceneObjectGroup.m_rootPart.Shape.State" at the same time<br>
> 2. Why the one saved in "avatarattachments" table is used when avatar logs<br>
> in?<br>
> 3. Why the one saved in<br>
> "SceneObjectGroup.m_rootPart.Shape.State" when "wear"?<br>
><br>
> 4. Why attachment offset is not saved in "avatarattachments" table<br>
>     but "SceneObjectGroup.m_rootPart.GroupPosition", which<br>
> is converted to "X", "Y", "Z" sub-elements of "GroupPosition" element in the<br>
> "data" filed of "assets" table?<br>
> 5. Is "SceneObjectGroup.AbsolutePosition" used as<br>
> attachment offset when a prim is attached?<br>
> 6. If the anser of Q.5 is "YES", how to know whether the prim is attached or<br>
> not when reading "data" from "assets" table?<br>
><br>
> Thanks in advance<br>
> Thomas<br>
><br>
</div></div>> _______________________________________________<br>
> Opensim-dev mailing list<br>
> <a href="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</a><br>
> <a href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target="_blank">https://lists.berlios.de/mailman/listinfo/opensim-dev</a><br>
><br>
><br>
_______________________________________________<br>
Opensim-dev mailing list<br>
<a href="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</a><br>
<a href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target="_blank">https://lists.berlios.de/mailman/listinfo/opensim-dev</a><br>
</blockquote></div><br></div>