private void UpdateLeftPosition() { //Log.Write("In UpdatePosition UserIn is: " + UserIn); //Log.Write("Left: " + agent.GetControlPointPosition(ControlPointType.LeftTool)); ObjectPrivate AgentObject = ScenePrivate.FindObject(agent.AgentInfo.ObjectId); if (MultiClick) { do { Vector AgentPosition = AgentObject.Position; Quaternion AgentRotation = AgentObject.Rotation; Vector LeftPosition = agent.GetControlPointPosition(ControlPointType.LeftTool); Vector WorldLeftPosition = LocalToWorld(AgentPosition, AgentRotation, LeftPosition); LeftActionToPerform(LeftPosition, WorldLeftPosition, AgentPosition, AgentRotation); Wait(TimeSpan.FromMilliseconds(timeDelay)); }while (UserIn && LeftTriggerPressed); } else { //do once Vector AgentPosition = AgentObject.Position; Quaternion AgentRotation = AgentObject.Rotation; Vector LeftPosition = agent.GetControlPointPosition(ControlPointType.LeftTool); Vector WorldLeftPosition = LocalToWorld(AgentPosition, AgentRotation, LeftPosition); LeftActionToPerform(LeftPosition, WorldLeftPosition, AgentPosition, AgentRotation); } //Log.Write("Out of Loop"); }
private void UpdatePosition() { //Log.Write("In UpdatePosition UserIn is: " + UserIn); //Log.Write("Left: " + agent.GetControlPointPosition(ControlPointType.LeftTool) + " Right: " + agent.GetControlPointPosition(ControlPointType.RightTool)); do { ObjectPrivate AgentObject = ScenePrivate.FindObject(agent.AgentInfo.ObjectId); Vector AgentPosition = AgentObject.Position; Quaternion AgentRotation = AgentObject.Rotation; Vector LeftPosition = agent.GetControlPointPosition(ControlPointType.LeftTool); Vector WorldLeftPosition = LocalToWorld(AgentPosition, AgentRotation, LeftPosition); Vector RightPosition = agent.GetControlPointPosition(ControlPointType.RightTool); Vector WorldRightPosition = LocalToWorld(AgentPosition, AgentRotation, RightPosition); ActionToPerform(LeftPosition, WorldLeftPosition, RightPosition, WorldRightPosition, AgentPosition, AgentRotation); Wait(TimeSpan.FromMilliseconds(timeDelay)); }while (UserIn); //Log.Write("Out of Loop"); }
private void getSegment(AgentPrivate ap, ObjectPrivate op, out Vector start, out Vector end) { float distance = 10; Quaternion orientation; Vector offset; ControlPointType controlPoint = ControlPointType.GazeTarget; if (ap.GetControlPointEnabled(controlPoint)) { offset = Vector.Forward * distance; start = ap.GetControlPointPosition(controlPoint); orientation = ap.GetControlPointOrientation(controlPoint); } else { offset = Vector.Left * distance; start = op.Position + Vector.Up * 0.5f; orientation = op.Rotation; } offset = offset.Rotate(ref orientation); end = start + offset; }