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

C# System.Vector3类代码示例

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

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



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

示例1: CreatePointEntity

        private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos)
        {
            SceneObjectPart y = new SceneObjectPart();

            //Initialize part
            y.Name = "Very Small Point";
            y.RegionHandle = scene.RegionInfo.RegionHandle;
            y.CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
            y.OwnerID = UUID.Zero;
            y.CreatorID = UUID.Zero;
            y.LastOwnerID = UUID.Zero;
            y.UUID = uuid;

            y.Shape = PrimitiveBaseShape.CreateBox();
            y.Scale = new Vector3(0.01f,0.01f,0.01f);
            y.LastOwnerID = UUID.Zero;
            y.GroupPosition = groupPos;
            y.OffsetPosition = new Vector3(0, 0, 0);
            y.RotationOffset = new Quaternion(0,0,0,0);
            y.Velocity = new Vector3(0, 0, 0);
            y.RotationalVelocity = new Vector3(0, 0, 0);
            y.AngularVelocity = new Vector3(0, 0, 0);
            y.Acceleration = new Vector3(0, 0, 0);

            y.Flags = 0;
            y.TrimPermissions();

            //Initialize group and add part as root part
            SceneObjectGroup x = new SceneObjectGroup(y);
            x.SetScene(scene);
            x.RegionHandle = scene.RegionInfo.RegionHandle;
            x.SetScene(scene);

            m_Entity = x;
        }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:35,代码来源:PointMetaEntity.cs


示例2: UseItem

        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            Log.Warn("Player " + player.Username + " should be banned for hacking!");

            var block = world.GetBlock(blockCoordinates);
            if (block is Tnt)
            {
                world.SetBlock(new Air() {Coordinates = block.Coordinates});
                new PrimedTnt(world)
                {
                    KnownPosition = new PlayerLocation(blockCoordinates.X, blockCoordinates.Y, blockCoordinates.Z),
                    Fuse = (byte) (new Random().Next(0, 20) + 10)
                }.SpawnEntity();
            }
            else if (block.IsSolid)
            {
                var affectedBlock = world.GetBlock(GetNewCoordinatesFromFace(blockCoordinates, BlockFace.Up));
                if (affectedBlock.Id == 0)
                {
                    var fire = new Fire
                    {
                        Coordinates = affectedBlock.Coordinates
                    };
                    world.SetBlock(fire);
                }
            }
        }
开发者ID:newchild,项目名称:MiNET,代码行数:27,代码来源:ItemFlintAndSteel.cs


示例3: drawLine

        public static void drawLine(Vector3 pos1, Vector3 pos2, int bold, System.Drawing.Color color)
        {
            var wts1 = Drawing.WorldToScreen(pos1);
            var wts2 = Drawing.WorldToScreen(pos2);

            Drawing.DrawLine(wts1[0], wts1[1], wts2[0], wts2[1], bold, color);
        }
开发者ID:sosll2005,项目名称:LeagueRepo,代码行数:7,代码来源:Ahri.cs


示例4: ShootBox

        public override void ShootBox(Vector3 camPos, Vector3 destination)
        {
            if (World != null)
            {
                const float mass = 1.0f;

                if (shootBoxShape == null)
                {
                    shootBoxShape = new BoxShape(1.0f);
                    shootBoxShape.InitializePolyhedralFeatures();
                }

                RigidBody body = LocalCreateRigidBody(mass, Matrix.Translation(camPos), shootBoxShape);
                body.LinearFactor = new Vector3(1, 1, 1);
                //body->setRestitution(1);

                Vector3 linVel = destination - camPos;
                linVel.Normalize();
                body.LinearVelocity = linVel * shootBoxInitialSpeed;
                body.AngularVelocity = Vector3.Zero;
                body.ContactProcessingThreshold = 1e30f;

                // when using m_ccdMode, disable regular CCD
                if (ccdMode)
                {
                    body.CcdMotionThreshold = 0.0001f;
                    body.CcdSweptSphereRadius = 0.4f;
                }
            }
        }
开发者ID:RainsSoft,项目名称:BulletSharpPInvoke,代码行数:30,代码来源:CcdPhysicsDemo.cs


示例5: OnBlockPlaced

 public override bool OnBlockPlaced(World world, Vector3 position, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     Metadata = (byte)MathHelper.DirectionByRotationFlat(usedBy);
     switch ((Direction)Metadata)
     {
         case Direction.North:
             Metadata = (byte)StairDirections.North;
             break;
         case Direction.South:
             Metadata = (byte)StairDirections.South;
             break;
         case Direction.West:
             Metadata = (byte)StairDirections.West;
             break;
         case Direction.East:
             Metadata = (byte)StairDirections.East;
             break;
     }
     if (clickedSide == Vector3.Down)
         Metadata |= 4;
     else if (clickedSide != Vector3.Up)
     {
         if (cursorPosition.Y >= 8)
             Metadata |= 4;
     }
     return true;
 }
开发者ID:seaboy1234,项目名称:Craft.Net,代码行数:27,代码来源:StairBlock.cs


示例6: OnUpdate

        public override void OnUpdate(long msec)
        {
            var g2d = Graphics2D.GetInstance ();
            var pos = g2d.GetMousePosition ();

            if (Input.GetKeyDown (KeyCode.Mouse0)) {
                var start = new Vector3 (pos.X, pos.Y, 1000);
                var end = new Vector3 (pos.X, pos.Y, -1000);
                var node = World.Pick (start, end);
                if (node != null) {
                    this.picked = node;
                    this.delta = pos - new Vector2 (node.Position.X, node.Position.Y);
                }
            }
            if (Input.GetKeyUp(KeyCode.Mouse0)) {
                this.picked = null;
            }

            if (picked != null) {
                var t = pos - delta;
                picked.Translation = new Vector3(t.X, t.Y, 0);
            }

            base.OnUpdate (msec);
        }
开发者ID:weimingtom,项目名称:erica,代码行数:25,代码来源:MyFloor.cs


示例7: ExplosionOnSurface

 public ExplosionOnSurface(MeshObject[] stages, Vector3 incRotationEarth)
 {
     Stages = stages;
     IncRotationEarth = incRotationEarth;
     CurrentStages = new List<int>();
     ExplosionsTurns = new List<Vector3>();
 }
开发者ID:GazarovVlad,项目名称:TheGame,代码行数:7,代码来源:ExplosionOnSurface.cs


示例8: NPCAvatar

 public NPCAvatar(string firstname, string lastname, Vector3 position, Scene scene)
 {
     m_firstname = firstname;
     m_lastname = lastname;
     m_startPos = position;
     m_scene = scene;
 }
开发者ID:N3X15,项目名称:VoxelSim,代码行数:7,代码来源:NPCAvatar.cs


示例9: GetNormals

 public override List<Vector3> GetNormals(Vector3 blockPos, bool XP, bool XM, bool YP, bool YM, bool TOP, bool BOTTOM)
 {
     List<Vector3> Norms = new List<Vector3>();
     // Sprite 1
     for (int i = 0; i < 6; i++)
     {
         Norms.Add(new Vector3(-0.7071f, 0.7071f, 0));
     }
     // Sprite 2
     for (int i = 0; i < 6; i++)
     {
         Norms.Add(new Vector3(0.7071f, -0.7071f, 0));
     }
     // Sprite 3
     for (int i = 0; i < 6; i++)
     {
         Norms.Add(new Vector3(0.7071f, 0.7071f, 0));
     }
     // Sprite 4
     for (int i = 0; i < 6; i++)
     {
         Norms.Add(new Vector3(-0.7071f, -0.7071f, 0));
     }
     return Norms;
 }
开发者ID:Morphan1,项目名称:Voxalia,代码行数:25,代码来源:BSD52a127.cs


示例10: TrackBallController

		public TrackBallController(Vector2 screenCenter, double trackBallRadius)
		{
			rotationStart = new Vector3();
			rotationCurrent = new Vector3();
			this.screenCenter = screenCenter;
			this.rotationTrackingRadius = trackBallRadius;
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:7,代码来源:TrackBallController.cs


示例11: BuffManagerArgs

 public BuffManagerArgs(string uniqueId, Obj_AI_Hero hero, Vector3 position, float endTime)
 {
     UniqueId = uniqueId;
     Hero = hero;
     Position = position;
     EndTime = endTime;
 }
开发者ID:Lizzaran,项目名称:LeagueSharp-Standalones,代码行数:7,代码来源:BuffManagerArgs.cs


示例12: CreateCap

        /// <summary>
        /// Helper method creates a triangle fan to close the ends of the cylinder.
        /// </summary>
        /// <param name="tessellation">The tessellation.</param>
        /// <param name="height">The height.</param>
        /// <param name="radius">The radius.</param>
        /// <param name="normal">The normal.</param>
        private void CreateCap(int tessellation, float height, float radius, Vector3 normal)
        {
            // Create cap indices.
            for (int i = 0; i < tessellation - 2; i++)
            {
                if (normal.Y > 0)
                {
                    this.AddIndex(this.VerticesCount);
                    this.AddIndex(this.VerticesCount + ((i + 1) % tessellation));
                    this.AddIndex(this.VerticesCount + ((i + 2) % tessellation));
                }
                else
                {
                    this.AddIndex(this.VerticesCount);
                    this.AddIndex(this.VerticesCount + ((i + 2) % tessellation));
                    this.AddIndex(this.VerticesCount + ((i + 1) % tessellation));
                }
            }

            // Create cap vertices.
            for (int i = 0; i < tessellation; i++)
            {
                float angle = i * MathHelper.TwoPi / tessellation;

                var dx = (float)Math.Cos(angle);
                var dz = (float)Math.Sin(angle);

                Vector3 iniPosition = new Vector3(dx, 0, dz);
                Vector3 position = (iniPosition * radius) + (normal * height);

                this.AddVertex(position, normal, new Vector2(dx, dz));
            }
        }
开发者ID:kguner,项目名称:Components,代码行数:40,代码来源:Cone.cs


示例13: TestRezObjectFromInventoryItem

        public void TestRezObjectFromInventoryItem()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();
            
            Scene scene = SceneSetupHelpers.SetupScene();
            UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
            SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
            SceneObjectPart sop1 = sog1.RootPart;

            // Create an object embedded inside the first
            UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
            TaskInventoryItem taskSceneObjectItem
                = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId);

            scene.AddSceneObject(sog1);

            Vector3 rezPos = new Vector3(10, 10, 10);
            Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
            Vector3 rezVel = new Vector3(2, 2, 2);

            scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);

            SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");

            Assert.That(rezzedObject, Is.Not.Null);
            Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));

            // Velocity doesn't get applied, probably because there is no physics in tests (yet)
//            Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
            Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));

            // Confusingly, this isn't the rezzedObject.Rotation
            Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot));
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:35,代码来源:TaskInventoryTests.cs


示例14: InitiatorArgs

 public InitiatorArgs(Obj_AI_Hero hero, Vector3 start, Vector3 end, float range)
 {
     Hero = hero;
     Start = start;
     End = end;
     Range = range;
 }
开发者ID:4859aa,项目名称:LeagueSharp-Dev,代码行数:7,代码来源:InitiatorArgs.cs


示例15: SignedDistance

        internal override float SignedDistance(ref Vector3 position, float lodVoxelSize, IMyModule macroModulator, IMyModule detailModulator)
        {
            Vector3 localPosition = position - m_translation;
            Vector3.Transform(ref localPosition, ref m_invRotation, out localPosition);

            var primaryDistance = new Vector2(localPosition.X, localPosition.Z).Length() - m_primaryRadius;
            var signedDistance = new Vector2(primaryDistance, localPosition.Y).Length() - m_secondaryRadius;

            var potentialHalfDeviation = m_potentialHalfDeviation + lodVoxelSize;
            if (signedDistance > potentialHalfDeviation)
                return 1f;
            else if (signedDistance < -potentialHalfDeviation)
                return -1f;

            if (m_enableModulation)
            {
                Debug.Assert(m_deviationFrequency != 0f);
                float normalizer = 0.5f * m_deviationFrequency;
                var tmp = localPosition * normalizer;
                float halfDeviationRatio = (float)macroModulator.GetValue(tmp.X, tmp.Y, tmp.Z);
                signedDistance -= halfDeviationRatio * m_secondaryHalfDeviation;
            }

            if (m_enableModulation && -m_detailSize < signedDistance && signedDistance < m_detailSize)
            {
                Debug.Assert(m_detailFrequency != 0f);
                float normalizer = 0.5f * m_detailFrequency;
                var tmp = localPosition * normalizer;
                signedDistance += m_detailSize * (float)detailModulator.GetValue(tmp.X, tmp.Y, tmp.Z);
            }

            return signedDistance / lodVoxelSize;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:33,代码来源:MyCsgShapeTorus.cs


示例16: ContactPoint

 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth, ActorTypes type)
 {
     Type = type;
     Position = position;
     SurfaceNormal = surfaceNormal;
     PenetrationDepth = penetrationDepth;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:7,代码来源:PhysicsActor.cs


示例17: ConvertPointsToViewSpace

 /* Convert world space coordinates (doubles) to view space (floats) */
 private Vector3[] ConvertPointsToViewSpace(List<Position> points, Camera camera)
 {
     Vector3[] verts = new Vector3[points.Count];
     for (int i = 0; i < points.Count; ++i)
         verts[i] = points[i].Diff(camera.Position);
     return verts;
 }
开发者ID:BackupTheBerlios,项目名称:flatfour-svn,代码行数:8,代码来源:Visualizer.cs


示例18: Chunk

 public Chunk(Vector3 chunkSize, Vector3 location, Island island)
 {
     this.mChunkSize = chunkSize;
     this.mChunkLocation = location;
     this.mVisible = new bool[16, 16, 16, 6];
     this.mIsland = island;
 }
开发者ID:RenaudWasTaken,项目名称:SkyLands,代码行数:7,代码来源:Chunk.cs


示例19: CylinderColliderShape

        /// <summary>
        /// Initializes a new instance of the <see cref="CylinderColliderShape"/> class.
        /// </summary>
        /// <param name="halfExtents">The half extents.</param>
        /// <param name="upAxis">Up axis.</param>
        public CylinderColliderShape(Vector3 halfExtents, Vector3 upAxis)
        {
            Type = ColliderShapeTypes.Cylinder;
            Is2D = false; //always false for cylinders

            Matrix rotation;
            Vector3 scaling;

            if (upAxis == Vector3.UnitX)
            {
                InternalShape = new BulletSharp.CylinderShapeX(halfExtents);

                rotation = Matrix.RotationZ((float)Math.PI / 2.0f);
                scaling = new Vector3(halfExtents.Y * 2.0f, halfExtents.X * 2.0f, halfExtents.Z * 2.0f);
            }
            else if (upAxis == Vector3.UnitZ)
            {
                InternalShape = new BulletSharp.CylinderShapeZ(halfExtents);

                rotation = Matrix.RotationX((float)Math.PI / 2.0f);
                scaling = new Vector3(halfExtents.X * 2.0f, halfExtents.Z * 2.0f, halfExtents.Y * 2.0f);
            }
            else //default to Y
            {
                InternalShape = new BulletSharp.CylinderShape(halfExtents);

                rotation = Matrix.Identity;
                scaling = halfExtents * 2.0f;
            }

            DebugPrimitiveMatrix = Matrix.Scaling(scaling * 1.01f) * rotation;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:37,代码来源:CylinderColliderShape.cs


示例20: Action

        public override void Action()
        {
            Random rng = Bot.Manager.Rng;
            GridRegion[] knownRegions;

            lock (Bot.Manager.RegionsKnown)
            {
                if (Bot.Manager.RegionsKnown.Count == 0)
                {
                    m_log.DebugFormat(
                        "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", Bot.Name);
                    return;
                }

                knownRegions = Bot.Manager.RegionsKnown.Values.ToArray();
            }

            Simulator sourceRegion = Bot.Client.Network.CurrentSim;
            GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)];
            Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50);

            m_log.DebugFormat(
                "[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}",
                Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition);

            Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition);
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:27,代码来源:TeleportBehaviour.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# System.Vector4类代码示例发布时间:2022-05-26
下一篇:
C# System.Vector2类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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