本文整理汇总了C#中VRageMath类的典型用法代码示例。如果您正苦于以下问题:C# VRageMath类的具体用法?C# VRageMath怎么用?C# VRageMath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VRageMath类属于命名空间,在下文中一共展示了VRageMath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBotSpawnPosition
public override bool GetBotSpawnPosition(string behaviorType, out VRageMath.Vector3D spawnPosition)
{
// CH: TODO: Do this more generically, so that modders would be able to define their own bot types and the way they spawn
if (behaviorType == "Spider")
{
MatrixD spawnMatrix;
bool success = GetSpiderSpawnPosition(out spawnMatrix, null);
spawnPosition = spawnMatrix.Translation;
return success;
}
else if (MySession.Static.LocalCharacter != null)
{
var pos = MySession.Static.LocalCharacter.PositionComp.GetPosition();
Vector3 up;
Vector3D right, forward;
up = MyGravityProviderSystem.CalculateNaturalGravityInPoint(pos);
if (up.LengthSquared() < 0.0001f) up = Vector3.Up;
else up = Vector3D.Normalize(up);
forward = Vector3.CalculatePerpendicularVector(up);
right = Vector3.Cross(forward, up);
spawnPosition = MyUtils.GetRandomDiscPosition(ref pos, 5.0f, ref forward, ref right);
return true;
}
spawnPosition = Vector3D.Zero;
return false;
}
示例2:
void IMyClipmapCell.UpdateWorldMatrix(ref VRageMath.MatrixD worldMatrix, bool sortIntoCullObjects)
{
m_worldMatrix = worldMatrix;
Matrix m = m_worldMatrix * Matrix.CreateScale(m_scale) * Matrix.CreateTranslation(m_translation);
m_actor.SetMatrix(ref m);
}
示例3: MyScreenShot
public MyScreenShot(VRageMath.Vector2 sizeMultiplier, string path, bool ignoreSprites, bool showNotification)
{
IgnoreSprites = ignoreSprites;
Path = path;
SizeMultiplier = sizeMultiplier;
ShowNotification = showNotification;
}
示例4: GetLineIntersectionExactAll
VRageMath.Vector3D? IMyCubeGrid.GetLineIntersectionExactAll(ref VRageMath.LineD line, out double distance, out IMySlimBlock intersectedBlock)
{
MySlimBlock block;
var retVal = GetLineIntersectionExactAll(ref line, out distance, out block);
intersectedBlock = block;
return retVal;
}
示例5: BindableVector3DModel
public BindableVector3DModel(VRageMath.Vector3 vector)
: this()
{
X = vector.X;
Y = vector.Y;
Z = vector.Z;
}
示例6: CreateCell
public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix)
{
var cell = new MyClipmapCellProxy(cellCoord, ref worldMatrix, m_renderFlags);
cell.SetVisibility(false);
cell.ScaleGroup = scaleGroup;
return cell;
}
示例7: BindablePoint3DIModel
public BindablePoint3DIModel(VRageMath.Vector3I vector)
: this()
{
X = vector.X;
Y = vector.Y;
Z = vector.Z;
}
示例8: ToSharpDX
public static SharpDX.Matrix ToSharpDX(VRageMath.Matrix matrix)
{
return new SharpDX.Matrix(matrix.M11, matrix.M12, matrix.M13, matrix.M14,
matrix.M21, matrix.M22, matrix.M23, matrix.M24,
matrix.M31, matrix.M32, matrix.M33, matrix.M34,
matrix.M41, matrix.M42, matrix.M43, matrix.M44);
}
示例9:
void IMyClipmapCell.UpdateWorldMatrix(ref VRageMath.MatrixD worldMatrix, bool sortIntoCullObjects)
{
m_worldMatrix = worldMatrix;
MatrixD m = MatrixD.CreateScale(m_scale) * MatrixD.CreateTranslation(m_translation) * m_worldMatrix;
m_actor.SetMatrix(ref m);
m_actor.SetAabb((BoundingBoxD)m_localAabb.Transform(m_worldMatrix));
}
示例10: CanRotateTo
protected override bool CanRotateTo(VRageMath.Vector3D targetPoint)
{
// if controlled by an engager, can always rotate
if (ControllingEngager)
return true;
// if controlled by a turret (not implemented)
return true;
}
示例11: GetBlocksInsideSphere
List<IMySlimBlock> IMyCubeGrid.GetBlocksInsideSphere(ref VRageMath.BoundingSphereD sphere)
{
HashSet<MySlimBlock> blocks = new HashSet<MySlimBlock>();
GetBlocksInsideSphere(ref sphere, blocks);
var result = new List<IMySlimBlock>(blocks.Count);
foreach (var block in blocks)
result.Add(block);
return result;
}
示例12: Draw
public override bool Draw(VRageMath.Vector2 position)
{
if (m_highlight)
MyGuiManager.DrawString(MyFontEnum.White, Text, position, Scale, null, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
else
MyGuiManager.DrawString(MyFontEnum.Blue, Text, position, Scale, VRageMath.Color.PowderBlue, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
m_linkImg.Draw(position + new Vector2(base.Size.X + m_linkImgSpace, 0));
m_highlight = false;
return true;
}
示例13: AccumulateCorrection
public override void AccumulateCorrection(ref VRageMath.Vector3 correction, ref float weight)
{
Vector3D position = Parent.PositionAndOrientation.Translation;
BoundingBoxD box = new BoundingBoxD(position - Vector3D.One, position + Vector3D.One);
Vector3D currentMovement = Parent.ForwardVector * Parent.Speed;
if (Parent.Speed > 0.01f)
currentMovement.Normalize();
// Don't do any correction if we're not moving
if (currentMovement.LengthSquared() < 0.01)
{
return;
}
var entities = MyEntities.GetEntitiesInAABB(ref box);
foreach (var entity in entities)
{
var environmentItems = entity as MyEnvironmentItems;
if (environmentItems == null) continue;
environmentItems.GetItemsInRadius(ref position, 6.0f, m_trees);
foreach (var item in m_trees)
{
Vector3D dir = item - position;
var dist = dir.Normalize();
dir = Vector3D.Reject(currentMovement, dir);
dir.Y = 0.0f;
if (dir.Z * dir.Z + dir.X * dir.X < 0.1)
{
Vector3D dirLocal = Vector3D.TransformNormal(dir, Parent.PositionAndOrientationInverted);
dir = position - item;
dir = Vector3D.Cross(Vector3D.Up, dir);
if (dirLocal.X < 0)
dir = -dir;
}
dir.Normalize();
correction += (6f - dist) * Weight * dir;
if (!correction.IsValid())
{
System.Diagnostics.Debugger.Break();
}
}
m_trees.Clear();
}
weight += Weight;
entities.Clear();
}
示例14: MyCsgShapeExcludedSphere
public MyCsgShapeExcludedSphere(VRageMath.Vector3 translation, float radius,float exclusionRadius, float halfDeviation = 0, float deviationFrequency = 0, float detailFrequency = 0)
{
m_translation = translation;
m_radius = radius;
m_halfDeviation = halfDeviation;
m_deviationFrequency = deviationFrequency;
m_detailFrequency = detailFrequency;
m_sphere = new MyCsgSphere(translation, radius, halfDeviation, deviationFrequency, detailFrequency);
m_exclusionSphere = new MyCsgSphere(translation, exclusionRadius, halfDeviation, deviationFrequency, detailFrequency);
}
示例15: MyClipmapCellProxy
internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix, RenderFlags additionalFlags = 0)
{
m_worldMatrix = worldMatrix;
m_actor = MyActorFactory.CreateSceneObject();
m_actor.SetMatrix(ref worldMatrix);
m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create());
m_lod = cellCoord.Lod;
Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod);
m_actor.GetRenderable().SetModel(Mesh);
m_actor.GetRenderable().m_additionalFlags = MyProxiesFactory.GetRenderableProxyFlags(additionalFlags);
}