• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# VRageMath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: MyScreenshot

        public MyScreenshot(VRageMath.Vector2 sizeMultiplier, string saveToPath, bool ignoreSprites, bool showNotification)
        {
            MyRender.Log.WriteLine("MyScreenshot.Constructor() - START");
            MyRender.Log.IncreaseIndent();

            System.Diagnostics.Debug.Assert(sizeMultiplier.X > 0 && sizeMultiplier.Y > 0);
            m_sizeMultiplier = sizeMultiplier;
            IgnoreSprites = ignoreSprites;
            ShowNotification = showNotification;

            m_fullPathToSave = saveToPath;
            m_datetimePrefix = MyValueFormatter.GetFormatedDateTimeForFilename(DateTime.Now);

            MyRender.Log.DecreaseIndent();
            MyRender.Log.WriteLine("MyScreenshot.Constructor() - END");
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:16,代码来源:MyScreenshot.cs


示例17: GenerateProceduralCell

        protected override MyProceduralCell GenerateProceduralCell(ref VRageMath.Vector3I cellId)
        {
            MyProceduralCell cell = new MyProceduralCell(cellId, this);
            ProfilerShort.Begin("GenerateProceduralCell");

            IMyModule densityFunctionFilled = GetCellDensityFunctionFilled(cell.BoundingVolume);
            if (densityFunctionFilled == null)
            {
                ProfilerShort.End();
                return null;
            }
            IMyModule densityFunctionRemoved = GetCellDensityFunctionRemoved(cell.BoundingVolume);

            int cellSeed = GetCellSeed(ref cellId);
            var random = MyRandom.Instance;
            using (random.PushSeed(cellSeed))
            {
                Vector3D position = new Vector3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
                position *= (CELL_SIZE - 2 * OBJECT_SEED_RADIUS) / CELL_SIZE;
                position += OBJECT_SEED_RADIUS / CELL_SIZE;
                position += (Vector3D)cellId;
                position *= CELL_SIZE;

                if (MyEntities.IsInsideWorld(position))
                {
                    ProfilerShort.Begin("GetValue");
                    var value = densityFunctionFilled.GetValue(position.X, position.Y, position.Z);
                    ProfilerShort.End();

                    if (value < m_objectDensity) // -1..+1
                    {
                        var size = MathHelper.Lerp(PLANET_SIZE_MIN, PLANET_SIZE_MAX, random.NextDouble());
                        var objectSeed = new MyObjectSeed(cell, position, size);
                        objectSeed.Type = MyObjectSeedType.Planet;
                        objectSeed.Seed = random.Next();
                        objectSeed.Index = 0;
                        objectSeed.UserData = new MySphereDensityFunction(position, OBJECT_SEED_RADIUS, OBJECT_SEED_RADIUS);

                        int index = 1;
                        GenerateObject(cell, objectSeed, ref index, random, densityFunctionFilled, densityFunctionRemoved);
                    }
                }
            }

            ProfilerShort.End();
            return cell;
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:47,代码来源:MyProceduralPlanetCellGenerator.cs


示例18: HandleInput

 public override bool HandleInput(VRageMath.Vector2 position)
 {
     var mouse = MyGuiManager.MouseCursorPosition;
     if (mouse.X > position.X + 0.001f && mouse.Y > position.Y && mouse.X < position.X + Size.X && mouse.Y < position.Y + Size.Y)
     {
         m_highlight = true;
         if (MyInput.Static.IsLeftMousePressed() && MyGuiManager.TotalTimeInMilliseconds - m_lastTimeClicked > MyGuiConstants.REPEAT_PRESS_DELAY)
         {
             m_onClick(Url);
             m_lastTimeClicked = MyGuiManager.TotalTimeInMilliseconds;
             return true;
         }
     }
     else
         m_highlight = false;
     return false;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:17,代码来源:MyRichLabelLink.cs


示例19: MyClipmapCellProxy

        internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.Matrix worldMatrix)
        {
            m_worldMatrix = worldMatrix;

            m_actor = MyActorFactory.CreateSceneObject();
            //m_mesh = new MyVoxelMesh(cellCoord.CoordInLod, cellCoord.Lod, "");
            //m_actor.GetRenderable().SetModel(m_mesh);
            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_discardingOn = false;
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:17,代码来源:MyClipmapHandler.cs


示例20: GetBotSpawnPosition

        public override bool GetBotSpawnPosition(string behaviorType, out VRageMath.Vector3D spawnPosition)
        {
            if (MySession.LocalCharacter != null)
            {
                var pos = MySession.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:fluxit,项目名称:SpaceEngineers,代码行数:20,代码来源:MySpaceBotFactory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# VSADDITEMOPERATION类代码示例发布时间:2022-05-24
下一篇:
C# VRage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap