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


C# VRageMath类代码示例

本文整理汇总了C#中VRageMath的典型用法代码示例。如果您正苦于以下问题:C# VRageMath类的具体用法?C# VRageMath怎么用?C# VRageMath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetBotSpawnPosition

        public override bool GetBotSpawnPosition(string behaviorType, out VRageMath.Vector3D spawnPosition)
        {
            // CH: TODO: Do this more generically, so that modders would be able to define their own bot types and the way they spawn
            if (behaviorType == "Spider")
            {
                MatrixD spawnMatrix;
                bool success = GetSpiderSpawnPosition(out spawnMatrix, null);
                spawnPosition = spawnMatrix.Translation;
                return success;
            }
            else if (MySession.Static.LocalCharacter != null)
            {
                var pos = MySession.Static.LocalCharacter.PositionComp.GetPosition();
                Vector3 up;
                Vector3D right, forward;

                up = MyGravityProviderSystem.CalculateNaturalGravityInPoint(pos);
                if (up.LengthSquared() < 0.0001f) up = Vector3.Up;
                else up = Vector3D.Normalize(up);
                forward = Vector3.CalculatePerpendicularVector(up);
                right = Vector3.Cross(forward, up);
                spawnPosition = MyUtils.GetRandomDiscPosition(ref pos, 5.0f, ref forward, ref right);
                return true;
            }

            spawnPosition = Vector3D.Zero;
            return false;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:28,代码来源:MySpaceBotFactory.cs

示例2:

        void IMyClipmapCell.UpdateWorldMatrix(ref VRageMath.MatrixD worldMatrix, bool sortIntoCullObjects)
        {
            m_worldMatrix = worldMatrix;

            Matrix m = m_worldMatrix * Matrix.CreateScale(m_scale) * Matrix.CreateTranslation(m_translation);
            m_actor.SetMatrix(ref m);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:7,代码来源:MyClipmapHandler.cs

示例3: MyScreenShot

 public MyScreenShot(VRageMath.Vector2 sizeMultiplier, string path, bool ignoreSprites, bool showNotification)
 {
     IgnoreSprites = ignoreSprites;
     Path = path;
     SizeMultiplier = sizeMultiplier;
     ShowNotification = showNotification;
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyDX9Gui.cs

示例4: GetLineIntersectionExactAll

 VRageMath.Vector3D? IMyCubeGrid.GetLineIntersectionExactAll(ref VRageMath.LineD line, out double distance, out IMySlimBlock intersectedBlock)
 {
     MySlimBlock block;
     var retVal = GetLineIntersectionExactAll(ref line, out distance, out block);
     intersectedBlock = block;
     return retVal;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCubeGrid_ModAPI.cs

示例5: BindableVector3DModel

 public BindableVector3DModel(VRageMath.Vector3 vector)
     : this()
 {
     X = vector.X;
     Y = vector.Y;
     Z = vector.Z;
 }
开发者ID:midspace,项目名称:SEToolbox,代码行数:7,代码来源:BindableVector3DModel.cs

示例6: CreateCell

 public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix)
 {
     var cell = new MyClipmapCellProxy(cellCoord, ref worldMatrix, m_renderFlags);
     cell.SetVisibility(false);
     cell.ScaleGroup = scaleGroup;
     return cell;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyClipmapHandler.cs

示例7: BindablePoint3DIModel

 public BindablePoint3DIModel(VRageMath.Vector3I vector)
     : this()
 {
     X = vector.X;
     Y = vector.Y;
     Z = vector.Z;
 }
开发者ID:midspace,项目名称:SEToolbox,代码行数:7,代码来源:BindablePoint3DIModel.cs

示例8: ToSharpDX

 public static SharpDX.Matrix ToSharpDX(VRageMath.Matrix matrix)
 {
     return new SharpDX.Matrix(matrix.M11, matrix.M12, matrix.M13, matrix.M14,
                               matrix.M21, matrix.M22, matrix.M23, matrix.M24,
                               matrix.M31, matrix.M32, matrix.M33, matrix.M34,
                               matrix.M41, matrix.M42, matrix.M43, matrix.M44);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:SharpDXHelper.cs

示例9:

        void IMyClipmapCell.UpdateWorldMatrix(ref VRageMath.MatrixD worldMatrix, bool sortIntoCullObjects)
        {
            m_worldMatrix = worldMatrix;

            MatrixD m = MatrixD.CreateScale(m_scale) * MatrixD.CreateTranslation(m_translation) * m_worldMatrix;
            m_actor.SetMatrix(ref m);
            m_actor.SetAabb((BoundingBoxD)m_localAabb.Transform(m_worldMatrix));
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:8,代码来源:MyClipmapCellProxy.cs

示例10: CanRotateTo

        protected override bool CanRotateTo(VRageMath.Vector3D targetPoint)
        {
            // if controlled by an engager, can always rotate
            if (ControllingEngager)
                return true;

            // if controlled by a turret (not implemented)
            return true;
        }
开发者ID:his1220,项目名称:Autopilot,代码行数:9,代码来源:FixedWeapon.cs

示例11: GetBlocksInsideSphere

 List<IMySlimBlock> IMyCubeGrid.GetBlocksInsideSphere(ref VRageMath.BoundingSphereD sphere)
 {
     HashSet<MySlimBlock> blocks = new HashSet<MySlimBlock>();
     GetBlocksInsideSphere(ref sphere, blocks);
     var result = new List<IMySlimBlock>(blocks.Count);
     foreach (var block in blocks)
         result.Add(block);
     return result;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyCubeGrid_ModAPI.cs

示例12: Draw

 public override bool Draw(VRageMath.Vector2 position)
 {
     if (m_highlight)
         MyGuiManager.DrawString(MyFontEnum.White, Text, position, Scale, null, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
     else
         MyGuiManager.DrawString(MyFontEnum.Blue, Text, position, Scale, VRageMath.Color.PowderBlue, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
     m_linkImg.Draw(position + new Vector2(base.Size.X + m_linkImgSpace, 0));
     m_highlight = false;
     return true;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:10,代码来源:MyRichLabelLink.cs

示例13: AccumulateCorrection

        public override void AccumulateCorrection(ref VRageMath.Vector3 correction, ref float weight)
        {
            Vector3D position = Parent.PositionAndOrientation.Translation;

            BoundingBoxD box = new BoundingBoxD(position - Vector3D.One, position + Vector3D.One);

            Vector3D currentMovement = Parent.ForwardVector * Parent.Speed;
            if (Parent.Speed > 0.01f)
                currentMovement.Normalize();

            // Don't do any correction if we're not moving
            if (currentMovement.LengthSquared() < 0.01)
            {
                return;
            }

            var entities = MyEntities.GetEntitiesInAABB(ref box);
            foreach (var entity in entities)
            {
                var environmentItems = entity as MyEnvironmentItems;
                if (environmentItems == null) continue;

                environmentItems.GetItemsInRadius(ref position, 6.0f, m_trees);

                foreach (var item in m_trees)
                {
                    Vector3D dir = item - position;
                    var dist = dir.Normalize();
                    dir = Vector3D.Reject(currentMovement, dir);

                    dir.Y = 0.0f;
                    if (dir.Z * dir.Z + dir.X * dir.X < 0.1)
                    {
                        Vector3D dirLocal = Vector3D.TransformNormal(dir, Parent.PositionAndOrientationInverted);
                        dir = position - item;
                        dir = Vector3D.Cross(Vector3D.Up, dir);
                        if (dirLocal.X < 0)
                            dir = -dir;
                    }

                    dir.Normalize();

                    correction += (6f - dist) * Weight * dir;
                    if (!correction.IsValid())
                    {
                        System.Diagnostics.Debugger.Break();
                    }
                }
                m_trees.Clear();
            }

            weight += Weight;

            entities.Clear();
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:55,代码来源:MyTreeAvoidance.cs

示例14: MyCsgShapeExcludedSphere

        public MyCsgShapeExcludedSphere(VRageMath.Vector3 translation, float radius,float exclusionRadius, float halfDeviation = 0, float deviationFrequency = 0, float detailFrequency = 0)
        {
            m_translation = translation;
            m_radius = radius;
            m_halfDeviation = halfDeviation;
            m_deviationFrequency = deviationFrequency;
            m_detailFrequency = detailFrequency;


            m_sphere = new MyCsgSphere(translation, radius, halfDeviation, deviationFrequency, detailFrequency);
            m_exclusionSphere = new MyCsgSphere(translation, exclusionRadius, halfDeviation, deviationFrequency, detailFrequency); 
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:12,代码来源:MyCsgShapeExcludedSphere.cs

示例15: MyClipmapCellProxy

		internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix, RenderFlags additionalFlags = 0)
        {
            m_worldMatrix = worldMatrix;

            m_actor = MyActorFactory.CreateSceneObject();
            m_actor.SetMatrix(ref worldMatrix);
            m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create());

            m_lod = cellCoord.Lod;

            Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod);
            m_actor.GetRenderable().SetModel(Mesh);
			m_actor.GetRenderable().m_additionalFlags = MyProxiesFactory.GetRenderableProxyFlags(additionalFlags);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:14,代码来源:MyClipmapCellProxy.cs


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