当前位置: 首页>>代码示例>>C#>>正文


C# SceneObjectGroup.AddKeyframedMotion方法代码示例

本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.AddKeyframedMotion方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.AddKeyframedMotion方法的具体用法?C# SceneObjectGroup.AddKeyframedMotion怎么用?C# SceneObjectGroup.AddKeyframedMotion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.Framework.Scenes.SceneObjectGroup的用法示例。


在下文中一共展示了SceneObjectGroup.AddKeyframedMotion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddGroupToSceneGraph


//.........这里部分代码省略.........
                    if (scale.X > m_parentScene.m_maxNonphys)
                        scale.X = m_parentScene.m_maxNonphys;
                    if (scale.Y > m_parentScene.m_maxNonphys)
                        scale.Y = m_parentScene.m_maxNonphys;
                    if (scale.Z > m_parentScene.m_maxNonphys)
                        scale.Z = m_parentScene.m_maxNonphys;
                }
                part.Shape.Scale = scale;
            }

            // if physical, make sure we're above the ground by at least 10 cm
            if ((sceneObject.RootPart.Flags & PrimFlags.Physics) != 0)
            {
                OpenSim.Framework.Geom.Box bbox = sceneObject.BoundingBox();
                float groundHeight = m_parentScene.Heightmap.CalculateHeightAt(sceneObject.AbsolutePosition.X, sceneObject.AbsolutePosition.Y);
                if (sceneObject.AbsolutePosition.Z + bbox.Size.Z <= groundHeight)
                {
                    Vector3 newPos = sceneObject.AbsolutePosition;
                    newPos.Z = (bbox.Size.Z / 2.0f) + groundHeight + 0.1f;

                    sceneObject.RootPart.SetGroupPositionDirect(newPos);
                }

                AddPhysicalObject();
            }

            // rationalize the group: fix any inconsistency in locked bits, and 
            // clear the default touch action of BUY for any objects not actually for sale, etc
            sceneObject.Rationalize(sceneObject.OwnerID, fromCrossing);

            sceneObject.AttachToScene(m_parentScene, fromStorage); // allocates the localIds for the prims
            if (!alreadyPersisted)
            {
                sceneObject.HasGroupChanged = true;
            }

            sceneObject.IsPersisted = alreadyPersisted;

            lock (sceneObject)
            {
                bool entityAdded = false;
                lock (m_dictionary_lock)
                {
                    if (!Entities.ContainsKey(sceneObject.LocalId))
                    {
                        Entities.Add(sceneObject);
                        foreach (SceneObjectPart part in sceneObject.Children.Values)
                        {
                            SceneObjectPartsByFullID[part.UUID] = part;
                            SceneObjectPartsByLocalID[part.LocalId] = part;
                        }

                        entityAdded = true;
                    }
                }

                if (entityAdded)
                {
                    m_numPrim += sceneObject.Children.Count;
                    m_parentScene.EventManager.TriggerParcelPrimCountTainted();

                    if (attachToBackup)
                    {
                        sceneObject.AttachToBackup();
                        //this gets the new object on the taint list
                        if (!alreadyPersisted)
                        {
                            sceneObject.HasGroupChanged = true;
                        }

                        m_parentScene.InspectForAutoReturn(sceneObject);
                    }

                    //This property doesn't work on rezzing, only on crossings or restarts
                    if ((fromStorage || fromCrossing) && sceneObject.RootPart.KeyframeAnimation != null)
                    {
                        if (sceneObject.RootPart.KeyframeAnimation.CurrentCommand == KeyframeAnimation.Commands.Play)
                        {
                            if (!fromStorage)
                            {
                                //Offset the initial position so that it is in the new region's coordinates
                                // (only if we are actually crossing from a different region)
                                Vector3 regionOffset = sceneObject.AbsolutePosition - sceneObject.OriginalEnteringScenePosition;
                                sceneObject.RootPart.KeyframeAnimation.InitialPosition += regionOffset;
                            }

                            sceneObject.AddKeyframedMotion(null, KeyframeAnimation.Commands.Play);
                        }
                    }

                    if (OnObjectCreate != null)
                        OnObjectCreate(sceneObject);

                    return true;
                }

            }

            return false;
        }
开发者ID:BogusCurry,项目名称:halcyon,代码行数:101,代码来源:SceneGraph.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectGroup.AddKeyframedMotion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。