Пример #1
0
        public void Normalize()
        {
            fint num = FVector3.Magnitude(this);

            if (num.raw > 1)
            {
                this /= num;
            }
            else
            {
                this = FVector3.zero;
            }
        }
Пример #2
0
        protected override void OnUpdate()
        {
            if (walking)
            {
                FVector3 nextPoint = path[pathIndex];

                nextPoint.y = voxelComponent.position.y;

                voxelComponent.position = FVector3.MoveTowards(voxelComponent.position, nextPoint, SimulationTime.deltaTime * speed);

                if (voxelComponent.position == nextPoint)
                {
                    pathIndex++;
                    if (pathIndex == path.Count)
                    {
                        path.Clear();
                        pathIndex = 0;
                        walking   = false;
                    }
                }
            }
        }
Пример #3
0
 public static FVector3 Cross(FVector3 lhs, FVector3 rhs)
 {
     return(new FVector3(lhs.y * rhs.z - lhs.z * rhs.y, lhs.z * rhs.x - lhs.x * rhs.z, lhs.x * rhs.y - lhs.y * rhs.x));
 }
Пример #4
0
 //
 // Static Methods
 //
 public static fint Angle(FVector3 from, FVector3 to)
 {
     return(FMath.Acos(FMath.Clamp(FVector3.Dot(from.normalized, to.normalized), -fint.one, fint.one)) * FMath.Rad2Deg);
 }
Пример #5
0
 public void Scale(FVector3 scale)
 {
     this.x *= scale.x;
     this.y *= scale.y;
     this.z *= scale.z;
 }
Пример #6
0
 public static FVector3 Scale(FVector3 a, FVector3 b)
 {
     return(new FVector3(a.x * b.x, a.y * b.y, a.z * b.z));
 }
Пример #7
0
 public static FVector3 Reflect(FVector3 inDirection, FVector3 inNormal)
 {
     return(fint.CreateFromInt(2) * FVector3.Dot(inNormal, inDirection) * inNormal + inDirection);
 }
Пример #8
0
 public static FVector3 Min(FVector3 lhs, FVector3 rhs)
 {
     return(new FVector3(FMath.Min(lhs.x, rhs.x), FMath.Min(lhs.y, rhs.y), FMath.Min(lhs.z, rhs.z)));
 }
Пример #9
0
        public static FVector3 Lerp(FVector3 from, FVector3 to, fint t)
        {
            t = FMath.Clamp01(t);

            return(new FVector3(from.x + (to.x - from.x) * t, from.y + (to.y - from.y) * t, from.z + (to.z - from.z) * t));
        }
Пример #10
0
 public static FVector3 Exclude(FVector3 excludeThis, FVector3 fromThat)
 {
     return(fromThat - FVector3.Project(fromThat, excludeThis));
 }
Пример #11
0
 public static fint Dot(FVector3 lhs, FVector3 rhs)
 {
     return(lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z);
 }
Пример #12
0
        public static fint Distance(FVector3 a, FVector3 b)
        {
            FVector3 vector = new FVector3(a.x - b.x, a.y - b.y, a.z - b.z);

            return(FMath.Sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z));
        }