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


C# Point3F.vectorScale方法代码示例

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


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

示例1: ServerCmdcarUnmountObj

        public void ServerCmdcarUnmountObj(coGameConnection client, coPlayer obj)
            {
            obj.unmount();
            obj.setControlObject(obj);

            TransformF ejectpos = obj.getTransform();
            ejectpos += new TransformF(0, 0, 5);
            obj.setTransform(ejectpos);

            coVehicle mvehicle = obj["mVehicle"];

            Point3F ejectvel = mvehicle.getVelocity();
            ejectvel += new Point3F(0, 0, 10);

            ejectvel = ejectvel.vectorScale(((coSimDataBlock) (obj.getDataBlock()))["mass"].AsFloat());

            obj.applyImpulse(ejectpos.MPosition, ejectvel);
            }
开发者ID:RichardRanft,项目名称:DNT-Torque3D-V1.1,代码行数:18,代码来源:VehicleWheeled.cs

示例2: ArmorDoDismount

        public void ArmorDoDismount(string datablock, string player, string sforced)
            {
            bool forced = sforced.AsBool();

            string vehicle = console.GetVarString(string.Format("{0}.mVehicle", player));
            if ((!SceneObject.isMounted(player)) || (!console.isObject(vehicle)))
                return;

            Point3F vvel = ShapeBase.getVelocity(vehicle);
            string vdb = console.getDatablock(vehicle).ToString(CultureInfo.InvariantCulture);
            int maxDismountSpeed = console.GetVarInt(string.Format("{0}.maxDismountSpeed", vdb));
            if ((vvel.len() <= maxDismountSpeed) || (forced))
                {
                TransformF pos = SceneObject.getTransform(player);
                TransformF rot = pos;
                TransformF oldpos = pos.copy();

                List<Point3F> vecs = new List<Point3F>();
                vecs.Add(new Point3F(-1, 0, 0));
                vecs.Add(new Point3F(0, 0, 1));
                vecs.Add(new Point3F(0, 0, -1));
                vecs.Add(new Point3F(1, 0, 0));
                vecs.Add(new Point3F(0, -1, 0));
                vecs.Add(new Point3F(0, 0, 0));

                Point3F impulsevec = new Point3F(0, 0, 0);


                TransformF r = math.MatrixMulVector(SceneObject.getTransform(player), vecs[0]);

                vecs[0] = r.MPosition;
                pos.MPosition.x = 0;
                pos.MPosition.y = 0;
                pos.MPosition.z = 0;

                const int numofAttempts = 5;
                int success = -1;

                for (int i = 0; i < numofAttempts; i++)
                    {
                    Point3F vectorscale = vecs[i].vectorScale(3);

                    pos = oldpos + new TransformF(vectorscale);
                    if (!Player.checkDismountPoint(player, oldpos.MPosition, pos.MPosition))
                        continue;
                    success = i;
                    impulsevec = vecs[i].copy();
                    break;
                    }
                if ((forced) && (success == -1))
                    pos = oldpos.copy();

                console.SetVar(string.Format("{0}.mountVehicle", player), false);

                SimObject.schedule(player, "4000", "mountVehicles", "true");
                SceneObject.unmount(player);
                SceneObject.setTransform(player, new TransformF(pos.MPosition.x, pos.MPosition.y, pos.MPosition.z, rot.MOrientation.x, rot.MOrientation.y, rot.MOrientation.z, rot.MAngle));

                Point3F velo = impulsevec.vectorScale(console.GetVarFloat(console.getDatablock(player) + ".mass"));
                velo.z = 1;

                ShapeBase.applyImpulse(player, pos.MPosition, velo);

                Point3F vel = ShapeBase.getVelocity(player);
                float vec = Point3F.vectorDot(vel, vel.normalizeSafe());
                if (vec > 50)
                    {
                    float scale = 50/vec;
                    ShapeBase.setVelocity(player, vel.vectorScale(scale));
                    }
                }
            else
                {
                MessageClient(console.GetVarString(player + ".client"), "msgUnmount", @"\c2Cannot exit %1 while moving.", console.GetVarString(vdb + ".nameTag"));
                }
            }
开发者ID:Winterleaf,项目名称:DNT-Torque3D-V1.0,代码行数:76,代码来源:Player.cs

示例3: ServerCmdcarUnmountObj

        public void ServerCmdcarUnmountObj(string client, string obj)
            {
            SceneObject.unmount(obj);
            Player.setControlObject(obj, obj);

            TransformF ejectpos = SceneObject.getTransform(obj);
            ejectpos += new TransformF(0, 0, 5);
            SceneObject.setTransform(obj, ejectpos);

            string mvehicle = console.GetVarString(string.Format("{0}.mVehicle", obj));

            Point3F ejectvel = ShapeBase.getVelocity(mvehicle);
            ejectvel += new Point3F(0, 0, 10);

            ejectvel = ejectvel.vectorScale((console.GetVarString(string.Format("{0}.mass", console.getDatablock(obj)))).AsFloat());
            ShapeBase.applyImpulse(obj, ejectpos.MPosition, ejectvel);
            }
开发者ID:Winterleaf,项目名称:DNT-Torque3D-V1.0,代码行数:17,代码来源:VehicleWheeled.cs

示例4: ArmorDoDismount

        public void ArmorDoDismount(coPlayerData datablock, coPlayer player, bool forced)
            {
            coVehicle vehicle = player["mVehicle"];
            if (!vehicle.isObject())
                return;
            if (!player.isMounted())
                return;


            Point3F vvel = vehicle.getVelocity();
            coVehicleData vdb = vehicle.getDataBlock();
            int maxDismountSpeed = vdb["maxDismountSpeed"].AsInt();
            if ((vvel.len() <= maxDismountSpeed) || (forced))
                {
                TransformF pos = player.getTransform();
                TransformF rot = pos;
                TransformF oldpos = pos.copy();

                List<Point3F> vecs = new List<Point3F> { new Point3F(-1, 0, 0), new Point3F(0, 0, 1), new Point3F(0, 0, -1), new Point3F(1, 0, 0), new Point3F(0, -1, 0), new Point3F(0, 0, 0) };

                Point3F impulsevec = new Point3F(0, 0, 0);


                TransformF r = math.MatrixMulVector(player.getTransform(), vecs[0]);

                vecs[0] = r.MPosition;
                pos.MPosition.x = 0;
                pos.MPosition.y = 0;
                pos.MPosition.z = 0;

                const int numofAttempts = 5;
                int success = -1;

                for (int i = 0; i < numofAttempts; i++)
                    {
                    Point3F vectorscale = vecs[i].vectorScale(3);

                    pos = oldpos + new TransformF(vectorscale);
                    if (!player.checkDismountPoint(oldpos.MPosition, pos.MPosition))
                        continue;
                    success = i;
                    impulsevec = vecs[i].copy();
                    break;
                    }
                if ((forced) && (success == -1))
                    pos = oldpos.copy();

                player["mountVehicle"] = false.AsString();
                player.schedule("4000", "mountVehicles", "true");
                player.unmount();
                player.setTransform(new TransformF(pos.MPosition.x, pos.MPosition.y, pos.MPosition.z, rot.MOrientation.x, rot.MOrientation.y, rot.MOrientation.z, rot.MAngle));


                Point3F velo = impulsevec.vectorScale(player["mass"].AsFloat());
                velo.z = 1;

                player.applyImpulse(pos.MPosition, velo);


                Point3F vel = player.getVelocity();
                float vec = Point3F.vectorDot(vel, vel.normalizeSafe());
                if (vec > 50)
                    {
                    float scale = 50 / vec;
                    player.setVelocity(vel.vectorScale(scale));
                    }
                }
            else
                {
                MessageClient(player["client"], "msgUnmount", @"\c2Cannot exit %1 while moving.", console.GetVarString(vdb + ".nameTag"));
                }
            }
开发者ID:RichardRanft,项目名称:DNT-Torque3D-V1.1,代码行数:72,代码来源:Player.cs


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