void HandleTouchBegin3(TouchBeginEventArgs args) { var graphics = Graphics; PhysicsWorld2D physicsWorld = scene.GetComponent <PhysicsWorld2D>(); RigidBody2D rigidBody = physicsWorld.GetRigidBody(new Vector2(args.X, args.Y), uint.MaxValue); // Raycast for RigidBody2Ds to pick if (rigidBody != null) { pickedNode = rigidBody.Node; StaticSprite2D staticSprite = pickedNode.GetComponent <StaticSprite2D>(); staticSprite.Color = (new Color(1.0f, 0.0f, 0.0f, 1.0f)); // Temporary modify color of the picked sprite rigidBody = pickedNode.GetComponent <RigidBody2D>(); // Create a ConstraintMouse2D - Temporary apply this constraint to the pickedNode to allow grasping and moving with touch ConstraintMouse2D constraintMouse = pickedNode.CreateComponent <ConstraintMouse2D>(); Vector3 pos = camera.ScreenToWorldPoint(new Vector3((float)args.X / graphics.Width, (float)args.Y / graphics.Height, 0.0f)); constraintMouse.Target = new Vector2(pos.X, pos.Y); constraintMouse.MaxForce = 1000 * rigidBody.Mass; constraintMouse.CollideConnected = true; constraintMouse.OtherBody = dummyBody; // Use dummy body instead of rigidBody. It's better to create a dummy body automatically in ConstraintMouse2D constraintMouse.DampingRatio = 0; } touchMoveEventToken = Input.SubscribeToTouchMove(HandleTouchMove3); touchEndEventToken = Input.SubscribeToTouchEnd(HandleTouchEnd3); }
protected override void TouchBegin(TouchBeginEventArgs e) { if (!UIPressed) { activeTouches.Add(e.TouchID, new Vector2(e.X, e.Y)); var clickedRay = cameraMover.Camera.GetScreenRay(e.X / (float)UI.Root.Width, e.Y / (float)UI.Root.Height); if (DoOnlySingleRaycasts) { var raycastResult = octree.RaycastSingle(clickedRay); if (raycastResult.HasValue) { //levelManager.HandleRaycast(Player, raycastResult.Value); } } else { var raycastResults = octree.Raycast(clickedRay); if (raycastResults.Count != 0) { //levelManager.HandleRaycast(Player, raycastResults); } } } else { UIPressed = false; } }
private void OnTouchBegin(TouchBeginEventArgs e) { var x = (float)e.X / Graphics.Width; var y = (float)e.Y / Graphics.Height; DetermineHit(x, y); }
public void OnTouchBegan(TouchBeginEventArgs eventArgs) { // Fill out variables for tap gesture tapTouchID = eventArgs.TouchID; tapTimeStamp = Time.ElapsedTime; currentScreenLayout.OnTouchBegan(eventArgs); }
private void HandleTouchBegin(TouchBeginEventArgs args) { StartTouch(new TouchState { ID = args.TouchID, ScreenPosition = new IntVector2(args.X, args.Y), Pressure = args.Pressure }); }
private void Input_TouchBegin(TouchBeginEventArgs obj) { Debug.WriteLine($"Input_TouchBegin {obj.X},{obj.Y}"); Ray cameraRay = Camera.GetScreenRay((float)obj.X / Graphics.Width, (float)obj.Y / Graphics.Height); var results = Octree.Raycast(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry); TouchedNode = results.Select(x => x.Node).FirstOrDefault(); if (TouchedNode != null) { Debug.WriteLine($"Input Touch"); } }
public TouchBeginEventArguments(TouchBeginEventArgs args) : base(args) { Pressure = args.Pressure; }
protected override void TouchBegin(TouchBeginEventArgs e) { }
void Input_TouchBegin(TouchBeginEventArgs e) { touchStarted = DateTime.UtcNow; }
private void OnTouchBegin(TouchBeginEventArgs args) { _touchBegin?.Invoke(this, new TouchBeginEventArguments(args)); }
void InputOnTouchBegin(TouchBeginEventArgs touchBeginEventArgs) { }
public TouchEventArguments(TouchBeginEventArgs args) { TouchID = args.TouchID; X = args.X; Y = args.Y; }
private void Input_TouchBegin(TouchBeginEventArgs obj) { }
public override void OnTouchBegan(TouchBeginEventArgs eventArgs) { }
void HandleTouchBegin3(TouchBeginEventArgs args) { var graphics = Graphics; PhysicsWorld2D physicsWorld = scene.GetComponent<PhysicsWorld2D>(); RigidBody2D rigidBody = physicsWorld.GetRigidBody(new Vector2(args.X, args.Y), uint.MaxValue); // Raycast for RigidBody2Ds to pick if (rigidBody != null) { pickedNode = rigidBody.Node; StaticSprite2D staticSprite = pickedNode.GetComponent<StaticSprite2D>(); staticSprite.Color=(new Color(1.0f, 0.0f, 0.0f, 1.0f)); // Temporary modify color of the picked sprite rigidBody = pickedNode.GetComponent<RigidBody2D>(); // Create a ConstraintMouse2D - Temporary apply this constraint to the pickedNode to allow grasping and moving with touch ConstraintMouse2D constraintMouse = pickedNode.CreateComponent<ConstraintMouse2D>(); Vector3 pos = camera.ScreenToWorldPoint(new Vector3((float)args.X / graphics.Width, (float)args.Y / graphics.Height, 0.0f)); constraintMouse.Target=new Vector2(pos.X, pos.Y); constraintMouse.MaxForce=1000 * rigidBody.Mass; constraintMouse.CollideConnected=true; constraintMouse.OtherBody=dummyBody; // Use dummy body instead of rigidBody. It's better to create a dummy body automatically in ConstraintMouse2D constraintMouse.DampingRatio=0; } touchMoveEventToken = Input.SubscribeToTouchMove(HandleTouchMove3); touchEndEventToken = Input.SubscribeToTouchEnd(HandleTouchEnd3); }
protected abstract void TouchBegin(TouchBeginEventArgs e);
public abstract void OnTouchBegan(TouchBeginEventArgs eventArgs);
void OnTouchBegin(TouchBeginEventArgs e) { scaling = false; }
public override void OnTouchBegan(TouchBeginEventArgs eventArgs) { CameraManager.EnableCameraScreens(true, Selection); touchThrottleTime = Time.SystemTime; }