public Collision( Point3 pt, Vector3 normal, float dist, float t ) { m_Point = pt; m_Normal = normal; m_Distance = dist; m_T = t; }
public void Set( UniPoint3 pt, Vector3 xAxis, Vector3 yAxis, Vector3 zAxis ) { Position = pt; m_Axis[ 0 ] = xAxis; m_Axis[ 1 ] = yAxis; m_Axis[ 2 ] = zAxis; }
public Projectile( Scene scene, Point3 start, Vector3 dir, float speed ) { m_Pos.Set( start ); m_Dir = dir; m_Speed = speed; m_Scene = scene; m_Scene.Renderables.Add( this ); IUpdateService updater = scene.GetService< IUpdateService >( ); updater[ "updateClock" ].Subscribe( Update ); }
/// <summary> /// Gets the position and tangent on the path at time t /// </summary> public void GetFrame( float t, out Point3 pt, out Vector3 dir ) { int ptIndex = ( int )t; if ( ptIndex == m_Points.Length - 1 ) { pt = m_Points[ ptIndex ]; dir = ( m_Points[ ptIndex ] - m_Points[ ptIndex - 1 ] ).MakeNormal( ); return; } float localT = t - ptIndex; Point3 start = m_Points[ ptIndex ]; Point3 end = m_Points[ ptIndex + 1 ]; pt = LineSegment3.GetPointOnLine( start, end, localT ); dir = ( end - start ).MakeNormal( ); }
public void Set( Vector3 xAxis, Vector3 yAxis, Vector3 zAxis ) { m_Axis[ 0 ] = xAxis; m_Axis[ 1 ] = yAxis; m_Axis[ 2 ] = zAxis; }
/// <summary> /// Forces an update of the current camera transform /// </summary> public void UpdateFrame( ) { Vector3 xAxis = new Vector3 ( ( Functions.Cos( m_S ) * Functions.Sin( m_T ) ), ( Functions.Cos( m_T ) ), ( Functions.Sin( m_S ) * Functions.Sin( m_T ) ) ); Vector3 yAxis = new Vector3 ( -( Functions.Cos( m_S ) * Functions.Cos( m_T ) ), -( -Functions.Sin( m_T ) ), -( Functions.Sin( m_S ) * Functions.Cos( m_T ) ) ); Vector3 zAxis = Vector3.Cross( xAxis, yAxis ); Position.Copy( m_LookAt ); Position.Add( zAxis * m_Radius ); m_UpdateFrame = false; SetViewFrame( xAxis, yAxis, zAxis ); }
/// <summary> /// Sets the camera frame /// </summary> protected void SetFrame( Point3 pt, Vector3 xAxis, Vector3 yAxis, Vector3 zAxis ) { m_CameraMatrix.Translation = pt; m_CameraMatrix.XAxis = xAxis; m_CameraMatrix.YAxis = yAxis; m_CameraMatrix.ZAxis = zAxis; UpdateInverseCameraMatrix( ); }
/// <summary> /// Setup constructor /// </summary> public UniRay3( UniPoint3 origin, Vector3 dir ) { m_Origin = origin; m_Direction = dir; }
/// <summary> /// Default constructor. Places the ray at the origin, pointing along the z axis /// </summary> public UniRay3( ) { m_Origin = new UniPoint3( ); m_Direction = Vector3.ZAxis; }
/// <summary> /// Setup constructor /// </summary> /// <param name="pt">Vertex position</param> /// <param name="normal">Vertex normal</param> /// <param name="texture0">Vertex texture unit 0 coordinate</param> public Vertex( Point3 pt, Vector3 normal, Point2 texture0 ) { m_Point = pt; m_Normal = normal; m_Texture0 = texture0; }
/// <summary> /// Updates camera frame /// </summary> private void UpdateCameraFrame( ) { Vector3 zAxis = new Vector3 ( ( Functions.Cos( m_S ) * Functions.Sin( m_T ) ), ( Functions.Cos( m_T ) ), ( Functions.Sin( m_S ) * Functions.Sin( m_T ) ) ); Vector3 yAxis = new Vector3 ( -( Functions.Cos( m_S ) * Functions.Cos( m_T ) ), -( -Functions.Sin( m_T ) ), -( Functions.Sin( m_S ) * Functions.Cos( m_T ) ) ); Vector3 xAxis = Vector3.Cross( zAxis, yAxis ); Point3 pt = m_LookAt + ( zAxis * m_Zoom ); SetFrame( pt, xAxis, yAxis, zAxis ); }
/// <summary> /// Adds a new control point at the specified position to the spline /// </summary> public void Add( Vector3 pt ) { m_Points.Add( new SplineControlPoint( m_Owner, m_Points.Count ) ); m_Owner.OnChanged( ); }
public void HandleMovement( MovementXzRequest movement ) { NextPosition += new Vector3( movement.DeltaX, 0, movement.DeltaZ ); }
/// <summary> /// Sets the left, up and ahead vectors /// </summary> public void SetFrame( Vector3 left, Vector3 up, Vector3 ahead ) { m_XAxis = left; m_YAxis = up; m_ZAxis = ahead; }
public void HandleRotation( TurnRequest rotation ) { float x = Functions.Cos( rotation.Rotation ); float z = Functions.Sin( rotation.Rotation ); m_ZAxis = new Vector3( x, 0, z ); m_XAxis = Vector3.Cross( m_YAxis, m_ZAxis ).MakeNormal( ); }
public void SetBounds( Point3 topLeft, Point3 topRight, Point3 bottomLeft ) { m_TopLeft = topLeft; m_TopRight = topRight; m_BottomLeft = bottomLeft; m_PatchXDir = m_TopRight - m_TopLeft; m_PatchZDir = m_BottomLeft - m_TopLeft; m_PatchWidth = m_PatchXDir.Length; m_PatchHeight = m_PatchZDir.Length; m_PatchXDir /= m_PatchWidth; m_PatchZDir /= m_PatchHeight; }
/// <summary> /// Sends a movement message to the target /// </summary> /// <param name="moveVec">Movement vector</param> private void SendMovement( Vector3 moveVec ) { moveVec *= SecondsPerUpdate; Target.HandleMessage( new MovementXzRequest( moveVec.X, moveVec.Z ) ); }