小编Chr*_*her的帖子

计算两个向量之间的角度

我想计算两个 System.Numerics.Vector3 之间的角度,但我找不到任何函数。Google 仅查找 2d 点的结果。我想在c#中实现这个。

c# math vector angle

1
推荐指数
1
解决办法
3204
查看次数

如何使用 C# 中的计时器使动作每 x 秒重复一次?

我\xc2\xb4m 试图在Unity 的游戏中编写一个功能,允许玩家回到5 秒前的位置,所以我希望每5 秒,保存玩家\xc2\xb4s 坐标以返回到如果您按下某个键,则会显示它们。

\n\n

我唯一不知道的就是与时间有关的一切。我看到了使用计时器的指南,但我不明白\xc2\xb4到底是什么,有人可以帮忙吗?

\n

c# timer unity-game-engine

1
推荐指数
1
解决办法
2万
查看次数

为什么返回的是List <char>?

我正在尝试使用“包含”方法提取与子字符串匹配的文件名。但是,回报似乎是List<char>但我期望List<string>

private void readAllAttribues()
{
    using (var reader = new StreamReader(attribute_file))
    {
        //List<string> AllLines = new List<string>();
        List<FileNameAttributeList> AllAttributes = new List<FileNameAttributeList>();

        while (!reader.EndOfStream)
        {
            FileNameAttributeList Attributes = new FileNameAttributeList();
            Attributes ImageAttributes = new Attributes();
            Point XY = new Point();
            string lineItem = reader.ReadLine();
            //AllLines.Add(lineItem);
            var values = lineItem.Split(',');

            Attributes.ImageFileName = values[1];
            XY.X = Convert.ToInt16(values[3]);
            XY.Y = Convert.ToInt16(values[4]);
            ImageAttributes.Location = XY;
            ImageAttributes.Radius = Convert.ToInt16(values[5]);
            ImageAttributes.Area = Convert.ToInt16(values[6]);
            AllAttributes.Add(Attributes);
        }
        List<string> unique_raw_filenames = AllAttributes.Where(x => x.ImageFileName.Contains(@"non")).FirstOrDefault().ImageFileName.ToList();
        List<string>var …
Run Code Online (Sandbox Code Playgroud)

c# contains list

0
推荐指数
1
解决办法
83
查看次数

标签 统计

c# ×3

angle ×1

contains ×1

list ×1

math ×1

timer ×1

unity-game-engine ×1

vector ×1