Update Drone.cs
This commit is contained in:
@ -293,6 +293,7 @@ namespace DroneSimulator
|
||||
Vector4 ori = GetOrientation();
|
||||
|
||||
Orientation = ori;
|
||||
float range = 0;
|
||||
|
||||
if (PosXYZ.Z <= 0)
|
||||
{
|
||||
@ -336,19 +337,19 @@ namespace DroneSimulator
|
||||
|
||||
float tilt = MathF.Sqrt((ori.X * ori.X) + (ori.Y * ori.Y)) * TO_RADI;
|
||||
|
||||
if (tilt < 90 && ori.W > 0) LaserRange = PosXYZ.Z / MathF.Cos(tilt);
|
||||
range = PosXYZ.Z / MathF.Cos(tilt);
|
||||
|
||||
if (tilt < 90 && ori.W > 0) LaserRange = range;
|
||||
else LaserRange = float.MaxValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
RealAcc.Update(Acc, tick);
|
||||
RealGyr.Update(Gyr, tick);
|
||||
RealRange.Update(LaserRange, tick);
|
||||
RealBar.Update(PosXYZ.Z, tick);
|
||||
RealPos.Update(PosXYZ, tick);
|
||||
|
||||
bool of = RealOF.Update(new Vector2(SpdXYZ.X - Gyr.Y, SpdXYZ.Y + Gyr.X), LaserRange, tick);
|
||||
bool of = RealOF.Update(new Vector2(SpdXYZ.X * range - Gyr.Y, SpdXYZ.Y * range + Gyr.X), LaserRange, tick);
|
||||
|
||||
if(of) lock (this)
|
||||
{
|
||||
|
Reference in New Issue
Block a user