public void Update() { if (physical.GetBody() == null) { return; } if (isRemote == false) { var body = physical.GetBody(); body.ApplyAngularImpulse(-body.AngularVelocity * body.Inertia, true); } isRemote = false; isThrust = false; isLeft = false; isRemote = false; }
public void Remote(float x, float y) { if (x < 0.005 && y < 0.005 && x > -0.005 && y > -0.005) { return; } if (physical?.GetBody() == null) { return; } isRemote = true; //Log.Trace("Remote 操作值"+x+" "+y); var point = new Vector2(x, y); //算出力的大小 var o = Vector2.DistanceSquared(new Vector2(0, 0), point) / 1f; physical?.AddThrust(500 * o); physical?.GetBody().MoveForward(point, 2); }