本文整理汇总了C#中System.Numerics.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# Vector3类的具体用法?C# Vector3怎么用?C# Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于System.Numerics命名空间,在下文中一共展示了Vector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PlaceBlock
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
Metadata = (byte) face;
world.SetBlock(this);
return true;
}
开发者ID:CRBairdUSA,项目名称:MiNET,代码行数:7,代码来源:Button.cs
示例2: PlaceBlock
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
if (face == BlockFace.Down) return true;
switch (face)
{
case BlockFace.Up:
Metadata = 5;
break;
case BlockFace.East:
Metadata = 4;
break;
case BlockFace.West:
Metadata = 3;
break;
case BlockFace.North:
Metadata = 2;
break;
case BlockFace.South:
Metadata = 1;
break;
}
world.SetBlock(this);
return true;
}
开发者ID:GoldishKirby,项目名称:MiNET,代码行数:26,代码来源:Torch.cs
示例3: ResetLocalSpace
public static void ResetLocalSpace(out Vector3 forward, out Vector3 side, out Vector3 up, out Vector3 position)
{
forward = -Vector3.UnitZ;
side = Vector3.UnitX;
up = Vector3.UnitY;
position = Vector3.Zero;
}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:7,代码来源:LocalSpaceBasisHelpers.cs
示例4: HowFarOutsidePath
/// <summary>
/// how far outside path tube is the given point? (negative is inside)
/// </summary>
/// <param name="pathway"></param>
/// <param name="point"></param>
/// <returns></returns>
public static float HowFarOutsidePath(this IPathway pathway, Vector3 point)
{
float outside;
Vector3 tangent;
pathway.MapPointToPath(point, out tangent, out outside);
return outside;
}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:13,代码来源:PathwayHelpers.cs
示例5: Mesh
public Mesh(string fileName = null)
{
Filename = fileName;
MinVertex = new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
MaxVertex = new Vector3(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);
SubMeshes = new List<SubMesh>();
}
开发者ID:GameDotNet,项目名称:Game.NET,代码行数:7,代码来源:Mesh.cs
示例6: LocalSpace
public LocalSpace(Vector3 up, Vector3 forward, Vector3 position)
{
Up = up;
Forward = forward;
Position = position;
SetUnitSideFromForwardAndUp();
}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:7,代码来源:LocalSpace.cs
示例7: PlaceBlock
// 000 001 010 011 100
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
byte direction = player.GetDirection();
byte upper = (byte) ((faceCoords.Y > 0.5 && face != BlockFace.Up) || face == BlockFace.Down ? 0x04 : 0x00);
switch (direction)
{
case 0:
Metadata = (byte) (0 | upper);
break;
case 1:
Metadata = (byte) (2 | upper);
break;
case 2:
Metadata = (byte) (1 | upper);
break;
case 3:
Metadata = (byte) (3 | upper);
break;
}
world.SetBlock(this);
return true;
}
开发者ID:CRBairdUSA,项目名称:MiNET,代码行数:26,代码来源:BlockStairs.cs
示例8: PlaceBlock
public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
byte direction = player.GetDirection();
switch (face)
{
case BlockFace.South: // ok
Metadata = 0;
break;
case BlockFace.North:
Metadata = 1;
break;
case BlockFace.West:
Metadata = 2;
break;
case BlockFace.East: // ok
Metadata = 3;
break;
}
Log.Warn($"Direction={direction}, face={face}, metadata={Metadata}");
world.SetBlock(this);
return true;
}
开发者ID:CRBairdUSA,项目名称:MiNET,代码行数:26,代码来源:CustomItemFrame.cs
示例9: MapPointToPath
// Given an arbitrary point ("A"), returns the nearest point ("P") on
// this path. Also returns, via output arguments, the path tangent at
// P and a measure of how far A is outside the Pathway's "tube". Note
// that a negative distance indicates A is inside the Pathway.
public virtual Vector3 MapPointToPath(Vector3 point, out Vector3 tangent, out float outside)
{
float minDistance = float.MaxValue;
Vector3 onPath = Vector3.Zero;
tangent = Vector3.Zero;
// loop over all segments, find the one nearest to the given point
for (int i = 1; i < PointCount; i++)
{
Vector3 chosen;
float d = PointToSegmentDistance(point, Points[i - 1], Points[i], Tangents[i], Lengths[i], out chosen);
if (d < minDistance)
{
minDistance = d;
onPath = chosen;
tangent = Tangents[i];
}
}
// measure how far original point is outside the Pathway's "tube"
outside = Vector3.Distance(onPath, point) - Radius;
// return point on path
return onPath;
}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:29,代码来源:PolylinePathway.cs
示例10: UseItem
public override void UseItem(Level world, Player player, BlockCoordinates targetCoordinates, BlockFace face, Vector3 faceCoords)
{
//if (player.GameMode != GameMode.Creative)
//{
// Item itemStackInHand = player.Inventory.GetItemInHand();
// itemStackInHand.Count--;
// if (itemStackInHand.Count <= 0)
// {
// // set empty
// player.Inventory.Slots[player.Inventory.Slots.IndexOf(itemStackInHand)] = new ItemAir();
// }
//}
_block.Coordinates = GetNewCoordinatesFromFace(targetCoordinates, face);
_block.Metadata = (byte) Metadata;
if ((player.GetBoundingBox() - 0.01f).Intersects(_block.GetBoundingBox()))
{
Log.Debug("Can't build where you are standing: " + _block.GetBoundingBox());
return;
}
if (!_block.CanPlace(world, face)) return;
if (_block.PlaceBlock(world, player, targetCoordinates, face, faceCoords)) return; // Handled
world.SetBlock(_block);
}
开发者ID:CRBairdUSA,项目名称:MiNET,代码行数:28,代码来源:ItemBlock.cs
示例11: IsInsidePath
/// <summary>
/// is the given point inside the path tube?
/// </summary>
/// <param name="pathway"></param>
/// <param name="point"></param>
/// <returns></returns>
public static bool IsInsidePath(this IPathway pathway, Vector3 point)
{
float outside;
Vector3 tangent;
pathway.MapPointToPath(point, out tangent, out outside);
return outside < 0;
}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:13,代码来源:PathwayHelpers.cs
示例12: UseItem
public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
if (player.GameMode != GameMode.Creative)
{
Item itemStackInHand = player.Inventory.GetItemInHand();
itemStackInHand.Count--;
if (itemStackInHand.Count <= 0)
{
// set empty
player.Inventory.Slots[player.Inventory.Slots.IndexOf(itemStackInHand)] = new ItemAir();
}
}
var coor = GetNewCoordinatesFromFace(blockCoordinates, face);
Chest chest = new Chest
{
Coordinates = coor,
};
if (!chest.CanPlace(world, face)) return;
chest.PlaceBlock(world, player, coor, face, faceCoords);
// Then we create and set the sign block entity that has all the intersting data
ChestBlockEntity chestBlockEntity = new ChestBlockEntity
{
Coordinates = coor
};
world.SetBlockEntity(chestBlockEntity);
}
开发者ID:GoldishKirby,项目名称:MiNET,代码行数:33,代码来源:ItemChest.cs
示例13: Vector4
/// <summary>
/// Constructs a Vector4 from the given Vector3 and a W component.
/// </summary>
/// <param name="value">The vector to use as the X, Y, and Z components.</param>
/// <param name="w">The W component.</param>
public Vector4(Vector3 value, Single w)
{
X = value.X;
Y = value.Y;
Z = value.Z;
W = w;
}
开发者ID:uQr,项目名称:referencesource,代码行数:12,代码来源:Vector4_Intrinsics.cs
示例14: WithinArea
private bool WithinArea(Vector3 location)
{
var differenceFromCenter = this.Position - location;
var uLength = Util.Projection(differenceFromCenter, uDirection);
var vLength = Util.Projection(differenceFromCenter, vDirection);
return uLength.Magnitude() <= width / 2f && vLength.Magnitude() <= height / 2f;
}
开发者ID:modulexcite,项目名称:dotnetsamples-1,代码行数:8,代码来源:Quad.cs
示例15: LocalizePosition
/// <summary>
/// Transforms a point in global space to its equivalent in local space.
/// </summary>
/// <param name="basis">The basis which this should operate on</param>
/// <param name="globalPosition">The global space position to transform.</param>
/// <returns>The global space position transformed to local space.</returns>
public static Vector3 LocalizePosition(this ILocalSpaceBasis basis, Vector3 globalPosition)
{
// global offset from local origin
Vector3 globalOffset = globalPosition - basis.Position;
// dot offset with local basis vectors to obtain local coordiantes
return LocalizeDirection(basis, globalOffset);
}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:14,代码来源:LocalSpaceBasisHelpers.cs
示例16: VertexPositionTextureNormalBinormalTangent
// ReSharper restore NotAccessedField.Global
// ReSharper restore MemberCanBePrivate.Global
public VertexPositionTextureNormalBinormalTangent(Vector3 position, Vector2 textureCoordinate, Vector3 normal, Vector3 binormal, Vector3 tangent)
{
Position = position.ToXNA();
TextureCoordinate = textureCoordinate.ToXNA();
Normal = normal.ToXNA();
Binormal = binormal.ToXNA();
Tangent = tangent.ToXNA();
}
开发者ID:xoxota99,项目名称:Myre,代码行数:11,代码来源:VertexPositionTextureNormalBinormalTangent.cs
示例17: Polygon
public Polygon(Vector3 position, IEnumerable<Vector3> points)
{
var pointsArray = points.ToArray();
this.points = pointsArray;
var rightDirection = pointsArray[0] - pointsArray[1];
NormalDirection = Vector3.Cross(Util.UpVector, rightDirection);
}
开发者ID:mellinoe,项目名称:RayTracer,代码行数:8,代码来源:Polygon.cs
示例18: Right
public static Matrix4x4 Right(this Matrix4x4 matrix, Vector3 value)
{
matrix.M11 = value.X;
matrix.M12 = value.Y;
matrix.M13 = value.Z;
return matrix;
}
开发者ID:xoxota99,项目名称:Myre,代码行数:8,代码来源:Matrix4x4Extensions.cs
示例19: Up
public static Matrix4x4 Up(this Matrix4x4 matrix, Vector3 value)
{
matrix.M21 = value.X;
matrix.M22 = value.Y;
matrix.M23 = value.Z;
return matrix;
}
开发者ID:xoxota99,项目名称:Myre,代码行数:8,代码来源:Matrix4x4Extensions.cs
示例20: Distance
/// <summary>
/// Gets the distance from the plane to the point.
/// </summary>
/// <param name="plane"></param>
/// <param name="point"></param>
/// <returns></returns>
public static float Distance(this Plane plane, Vector3 point)
{
//http://stackoverflow.com/questions/4436160/distance-to-a-plane
float dot = Vector3.Dot(plane.Normal, point);
float value = dot + plane.D;
return value;
}
开发者ID:xoxota99,项目名称:Myre,代码行数:14,代码来源:PlaneExtensions.cs
注:本文中的System.Numerics.Vector3类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论