// }
if (getBasePrim().ParentID == 0)
{
// We are the root prim, return our interpolated position
RenderPosition = new Vector3(InterpolatedPosition);
RenderRotation = new Quaternion(InterpolatedRotation);
return;
}
else
{
RenderPosition = new Vector3(RHelp.InvalidPosition);
RenderRotation = new Quaternion(Quaternion.Identity);
// Not root, find our parent
SceneObject p = getParentSceneObject();
if (p == null)
{
System.out.println("Parent Primitive is null...");
return;
}
// If we don't know parent position, recursively find out
if (!p.PositionCalculated)
{
p.calPrimPosAndRot(cameraRenderPosition);
p.DistanceSquared = Vector3.distanceSquared(cameraRenderPosition, p.RenderPosition);
p.PositionCalculated = true;
}
Vector3 parentPos = new Vector3(p.RenderPosition);
Quaternion parentRot = new Quaternion(p.RenderRotation);
if (p instanceof RenderPrimitive)
{
// Child prim (our parent is another prim here)
RenderPosition = Vector3.add(parentPos, Vector3.multiply(InterpolatedPosition, parentRot));
RenderRotation = Quaternion.multiply(parentRot, InterpolatedRotation);
}
else if (p instanceof RenderAvatar)
{
//TODO only for debug
RenderPosition = new Vector3(p.RenderPosition);
RenderRotation = new Quaternion(p.RenderRotation);
//TODO implement
// // Calculating position and rotation of the root prim of an attachment here
// // (our parent is an avatar here)
// RenderAvatar parentav = (RenderAvatar)p;