本文整理汇总了C#中System.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# Vector3类的具体用法?C# Vector3怎么用?C# Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于System命名空间,在下文中一共展示了Vector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePointEntity
private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos)
{
SceneObjectPart y = new SceneObjectPart();
//Initialize part
y.Name = "Very Small Point";
y.RegionHandle = scene.RegionInfo.RegionHandle;
y.CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
y.OwnerID = UUID.Zero;
y.CreatorID = UUID.Zero;
y.LastOwnerID = UUID.Zero;
y.UUID = uuid;
y.Shape = PrimitiveBaseShape.CreateBox();
y.Scale = new Vector3(0.01f,0.01f,0.01f);
y.LastOwnerID = UUID.Zero;
y.GroupPosition = groupPos;
y.OffsetPosition = new Vector3(0, 0, 0);
y.RotationOffset = new Quaternion(0,0,0,0);
y.Velocity = new Vector3(0, 0, 0);
y.RotationalVelocity = new Vector3(0, 0, 0);
y.AngularVelocity = new Vector3(0, 0, 0);
y.Acceleration = new Vector3(0, 0, 0);
y.Flags = 0;
y.TrimPermissions();
//Initialize group and add part as root part
SceneObjectGroup x = new SceneObjectGroup(y);
x.SetScene(scene);
x.RegionHandle = scene.RegionInfo.RegionHandle;
x.SetScene(scene);
m_Entity = x;
}
示例2: UseItem
public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
{
Log.Warn("Player " + player.Username + " should be banned for hacking!");
var block = world.GetBlock(blockCoordinates);
if (block is Tnt)
{
world.SetBlock(new Air() {Coordinates = block.Coordinates});
new PrimedTnt(world)
{
KnownPosition = new PlayerLocation(blockCoordinates.X, blockCoordinates.Y, blockCoordinates.Z),
Fuse = (byte) (new Random().Next(0, 20) + 10)
}.SpawnEntity();
}
else if (block.IsSolid)
{
var affectedBlock = world.GetBlock(GetNewCoordinatesFromFace(blockCoordinates, BlockFace.Up));
if (affectedBlock.Id == 0)
{
var fire = new Fire
{
Coordinates = affectedBlock.Coordinates
};
world.SetBlock(fire);
}
}
}
示例3: drawLine
public static void drawLine(Vector3 pos1, Vector3 pos2, int bold, System.Drawing.Color color)
{
var wts1 = Drawing.WorldToScreen(pos1);
var wts2 = Drawing.WorldToScreen(pos2);
Drawing.DrawLine(wts1[0], wts1[1], wts2[0], wts2[1], bold, color);
}
示例4: ShootBox
public override void ShootBox(Vector3 camPos, Vector3 destination)
{
if (World != null)
{
const float mass = 1.0f;
if (shootBoxShape == null)
{
shootBoxShape = new BoxShape(1.0f);
shootBoxShape.InitializePolyhedralFeatures();
}
RigidBody body = LocalCreateRigidBody(mass, Matrix.Translation(camPos), shootBoxShape);
body.LinearFactor = new Vector3(1, 1, 1);
//body->setRestitution(1);
Vector3 linVel = destination - camPos;
linVel.Normalize();
body.LinearVelocity = linVel * shootBoxInitialSpeed;
body.AngularVelocity = Vector3.Zero;
body.ContactProcessingThreshold = 1e30f;
// when using m_ccdMode, disable regular CCD
if (ccdMode)
{
body.CcdMotionThreshold = 0.0001f;
body.CcdSweptSphereRadius = 0.4f;
}
}
}
示例5: OnBlockPlaced
public override bool OnBlockPlaced(World world, Vector3 position, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
{
Metadata = (byte)MathHelper.DirectionByRotationFlat(usedBy);
switch ((Direction)Metadata)
{
case Direction.North:
Metadata = (byte)StairDirections.North;
break;
case Direction.South:
Metadata = (byte)StairDirections.South;
break;
case Direction.West:
Metadata = (byte)StairDirections.West;
break;
case Direction.East:
Metadata = (byte)StairDirections.East;
break;
}
if (clickedSide == Vector3.Down)
Metadata |= 4;
else if (clickedSide != Vector3.Up)
{
if (cursorPosition.Y >= 8)
Metadata |= 4;
}
return true;
}
示例6: OnUpdate
public override void OnUpdate(long msec)
{
var g2d = Graphics2D.GetInstance ();
var pos = g2d.GetMousePosition ();
if (Input.GetKeyDown (KeyCode.Mouse0)) {
var start = new Vector3 (pos.X, pos.Y, 1000);
var end = new Vector3 (pos.X, pos.Y, -1000);
var node = World.Pick (start, end);
if (node != null) {
this.picked = node;
this.delta = pos - new Vector2 (node.Position.X, node.Position.Y);
}
}
if (Input.GetKeyUp(KeyCode.Mouse0)) {
this.picked = null;
}
if (picked != null) {
var t = pos - delta;
picked.Translation = new Vector3(t.X, t.Y, 0);
}
base.OnUpdate (msec);
}
示例7: ExplosionOnSurface
public ExplosionOnSurface(MeshObject[] stages, Vector3 incRotationEarth)
{
Stages = stages;
IncRotationEarth = incRotationEarth;
CurrentStages = new List<int>();
ExplosionsTurns = new List<Vector3>();
}
示例8: NPCAvatar
public NPCAvatar(string firstname, string lastname, Vector3 position, Scene scene)
{
m_firstname = firstname;
m_lastname = lastname;
m_startPos = position;
m_scene = scene;
}
示例9: GetNormals
public override List<Vector3> GetNormals(Vector3 blockPos, bool XP, bool XM, bool YP, bool YM, bool TOP, bool BOTTOM)
{
List<Vector3> Norms = new List<Vector3>();
// Sprite 1
for (int i = 0; i < 6; i++)
{
Norms.Add(new Vector3(-0.7071f, 0.7071f, 0));
}
// Sprite 2
for (int i = 0; i < 6; i++)
{
Norms.Add(new Vector3(0.7071f, -0.7071f, 0));
}
// Sprite 3
for (int i = 0; i < 6; i++)
{
Norms.Add(new Vector3(0.7071f, 0.7071f, 0));
}
// Sprite 4
for (int i = 0; i < 6; i++)
{
Norms.Add(new Vector3(-0.7071f, -0.7071f, 0));
}
return Norms;
}
示例10: TrackBallController
public TrackBallController(Vector2 screenCenter, double trackBallRadius)
{
rotationStart = new Vector3();
rotationCurrent = new Vector3();
this.screenCenter = screenCenter;
this.rotationTrackingRadius = trackBallRadius;
}
示例11: BuffManagerArgs
public BuffManagerArgs(string uniqueId, Obj_AI_Hero hero, Vector3 position, float endTime)
{
UniqueId = uniqueId;
Hero = hero;
Position = position;
EndTime = endTime;
}
示例12: CreateCap
/// <summary>
/// Helper method creates a triangle fan to close the ends of the cylinder.
/// </summary>
/// <param name="tessellation">The tessellation.</param>
/// <param name="height">The height.</param>
/// <param name="radius">The radius.</param>
/// <param name="normal">The normal.</param>
private void CreateCap(int tessellation, float height, float radius, Vector3 normal)
{
// Create cap indices.
for (int i = 0; i < tessellation - 2; i++)
{
if (normal.Y > 0)
{
this.AddIndex(this.VerticesCount);
this.AddIndex(this.VerticesCount + ((i + 1) % tessellation));
this.AddIndex(this.VerticesCount + ((i + 2) % tessellation));
}
else
{
this.AddIndex(this.VerticesCount);
this.AddIndex(this.VerticesCount + ((i + 2) % tessellation));
this.AddIndex(this.VerticesCount + ((i + 1) % tessellation));
}
}
// Create cap vertices.
for (int i = 0; i < tessellation; i++)
{
float angle = i * MathHelper.TwoPi / tessellation;
var dx = (float)Math.Cos(angle);
var dz = (float)Math.Sin(angle);
Vector3 iniPosition = new Vector3(dx, 0, dz);
Vector3 position = (iniPosition * radius) + (normal * height);
this.AddVertex(position, normal, new Vector2(dx, dz));
}
}
示例13: TestRezObjectFromInventoryItem
public void TestRezObjectFromInventoryItem()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene();
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
// Create an object embedded inside the first
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
TaskInventoryItem taskSceneObjectItem
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId);
scene.AddSceneObject(sog1);
Vector3 rezPos = new Vector3(10, 10, 10);
Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
Vector3 rezVel = new Vector3(2, 2, 2);
scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);
SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");
Assert.That(rezzedObject, Is.Not.Null);
Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));
// Velocity doesn't get applied, probably because there is no physics in tests (yet)
// Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));
// Confusingly, this isn't the rezzedObject.Rotation
Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot));
}
示例14: InitiatorArgs
public InitiatorArgs(Obj_AI_Hero hero, Vector3 start, Vector3 end, float range)
{
Hero = hero;
Start = start;
End = end;
Range = range;
}
示例15: SignedDistance
internal override float SignedDistance(ref Vector3 position, float lodVoxelSize, IMyModule macroModulator, IMyModule detailModulator)
{
Vector3 localPosition = position - m_translation;
Vector3.Transform(ref localPosition, ref m_invRotation, out localPosition);
var primaryDistance = new Vector2(localPosition.X, localPosition.Z).Length() - m_primaryRadius;
var signedDistance = new Vector2(primaryDistance, localPosition.Y).Length() - m_secondaryRadius;
var potentialHalfDeviation = m_potentialHalfDeviation + lodVoxelSize;
if (signedDistance > potentialHalfDeviation)
return 1f;
else if (signedDistance < -potentialHalfDeviation)
return -1f;
if (m_enableModulation)
{
Debug.Assert(m_deviationFrequency != 0f);
float normalizer = 0.5f * m_deviationFrequency;
var tmp = localPosition * normalizer;
float halfDeviationRatio = (float)macroModulator.GetValue(tmp.X, tmp.Y, tmp.Z);
signedDistance -= halfDeviationRatio * m_secondaryHalfDeviation;
}
if (m_enableModulation && -m_detailSize < signedDistance && signedDistance < m_detailSize)
{
Debug.Assert(m_detailFrequency != 0f);
float normalizer = 0.5f * m_detailFrequency;
var tmp = localPosition * normalizer;
signedDistance += m_detailSize * (float)detailModulator.GetValue(tmp.X, tmp.Y, tmp.Z);
}
return signedDistance / lodVoxelSize;
}