SEToolbox.Models.StructureCubeGridModel.MaxVelocityAtPlayer C# (CSharp) Method

MaxVelocityAtPlayer() public method

public MaxVelocityAtPlayer ( VRageMath playerPosition ) : void
playerPosition VRageMath
return void
        public void MaxVelocityAtPlayer(VRageMath.Vector3D playerPosition)
        {
            var v = playerPosition - CubeGrid.PositionAndOrientation.Value.Position;
            v.Normalize();
            v = Vector3.Multiply(v, SpaceEngineersConsts.MaxShipVelocity);

            CubeGrid.LinearVelocity = (Vector3)v;
            CubeGrid.AngularVelocity = new VRageMath.Vector3(0, 0, 0);
            RaisePropertyChanged(() => LinearVelocity);
        }