本文整理汇总了C#中System.Vector3.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Add方法的具体用法?C# Vector3.Add怎么用?C# Vector3.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: pasteToolStripMenuItem_Click
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
List<Item> objs = Clipboard.GetData("SADXLVLObjectList") as List<Item>;
if (objs == null)
{
MessageBox.Show("Paste operation failed - this is a known issue and is being worked on.");
return; // todo: finish implementing proper copy/paste
}
Vector3 center = new Vector3();
foreach (Item item in objs)
center.Add(item.Position.ToVector3());
center = new Vector3(center.X / objs.Count, center.Y / objs.Count, center.Z / objs.Count);
foreach (Item item in objs)
{
item.Position = new Vertex(item.Position.X - center.X + cam.Position.X, item.Position.Y - center.Y + cam.Position.Y, item.Position.Z - center.Z + cam.Position.Z);
item.Paste();
}
selectedItems.Add(new List<Item>(objs));
DrawLevel();
}
示例2: ApplyJumpVelocity
/// <summary>
/// Changes the relative velocity between the character and its support.
/// </summary>
/// <param name="supportData">Support data to use to jump.</param>
/// <param name="velocityChange">Change to apply to the character and support relative velocity.</param>
/// <param name="relativeVelocity">Relative velocity to update.</param>
void ApplyJumpVelocity(ref SupportData supportData, Vector3 velocityChange, ref Vector3 relativeVelocity)
{
Vector3 tmp;
Body.LinearVelocity.Add( ref velocityChange, out tmp );
Body.LinearVelocity = tmp;
var entityCollidable = supportData.SupportObject as EntityCollidable;
if (entityCollidable != null)
{
if (entityCollidable.Entity.IsDynamic)
{
Vector3 change; velocityChange.Mult( jumpForceFactor, out change );
//Multiple characters cannot attempt to modify another entity's velocity at the same time.
entityCollidable.Entity.Locker.Enter();
try
{
change.Mult( -Body.Mass, out tmp );
entityCollidable.Entity.LinearMomentum.Add( ref tmp, out tmp );
entityCollidable.Entity.LinearMomentum = tmp;
}
finally
{
entityCollidable.Entity.Locker.Exit();
}
velocityChange.Add( ref change, out velocityChange );
}
}
//Update the relative velocity as well. It's a ref parameter, so this update will be reflected in the calling scope.
Vector3.Add(ref relativeVelocity, ref velocityChange, out relativeVelocity);
}
示例3: CreateVertices
protected void CreateVertices(object sender, EventArgs e) {
VertexBuffer buffer = (VertexBuffer)sender;
VERTEX_FORMAT[] vertices = (VERTEX_FORMAT[])buffer.Lock(0,0);
float val = 0.0f;
float minZ = m_globalClipping.ZMin;
float maxZ = m_globalClipping.ZMax;
float a = MAXHUEVALUE / (maxZ - minZ);
float b = -minZ * a;
int i=0;
ILColorProvider colHelp = new ILColorProvider(0.0f,0.5f,1.0f);
for (int r = 0; r < m_rows; r++) {
for (int c = 0; c < m_cols; c++) {
val = m_sourceArray.GetValue(c,r);
vertices[i].X = c;
vertices[i].Y = r;
vertices[i].Z = val;
vertices[i++].Color = colHelp.H2RGB(MAXHUEVALUE - val * a - b);
}
}
#region create normals
//
Vector3 normal;
i = 0;
for (int r = 0; r < m_rows; r++) {
for (int c = 0; c < m_cols; c++,i++) {
normal = new Vector3();
if (c > 0 && c < m_cols)
normal.Add(vertices[i-1].Position);
if (c < m_cols-1)
normal.Add(vertices[i+1].Position);
if (r > 0 && r < m_rows)
normal.Add(vertices[i-m_cols].Position);
if (r < m_rows - 1)
normal.Add(vertices[i+m_cols].Position);
normal.Normalize();
vertices[i].Normal = normal;
}
}
#endregion
buffer.Unlock();
m_vertexReady = true;
}
示例4: drawContactPoint
public void drawContactPoint( Display render, ref Vector3 PointOnB, ref Vector3 normalOnB, double distance, int lifeTime, ref Vector3 color )
{
Vector3 tmpD;
PointOnB.Add( ref normalOnB, out tmpD );
drawLine( render, ref PointOnB, ref tmpD, ref color, ref color );
}
示例5: add
public void add() {
var a = new Vector3(1, 3, 5);
var b = new Vector3(5, 7, 9);
Assert.Equal(new Vector3(6, 10, 14), a.Add(b));
}