Questions tagged [hittest]

Hit-testing (hit detection, picking, or pick correlation) is the process of determining whether a given object intersects another given object shape, line, or curve drawn on the screen.

Hit-testing (hit detection, picking, or pick correlation) is the process of determining whether a given object intersects another given object shape, line, or curve drawn on the screen.

Most commonly, hit-testing is used by GUI environments to respond to user actions. In addition, hit-testing is used in small-scale games, which do not require much computing power, and are thus able to perform all of their collision detection tests in one frame of the game loop.

In Web programming languages such as SVG and CSS, this is associated with the concept of pointer-events (e.g. user-initiated cursor movement or object selection).

543 questions
1
vote
1 answer

AS3: Point for display object x, y?

Right now I have a point that I have to update with the x and y of a display object to use with the hitTestPoint object; is there any way I can get a point from a display object without having to make a new point var and continually update its x and…
user280896
  • 11
  • 3
1
vote
0 answers

Working with hit-test and UIGestureRecognizers

I'm writing my own map annotation layer which allows annotations to stick to a side of the screen (indicating something off screen). It works well. I can add/removre annotations. Rotate the map -> the annotations follow. Pinch to zoom -> the…
VaporwareWolf
  • 10,143
  • 10
  • 54
  • 80
1
vote
2 answers

In SpriteKit, how is zPosition used for rendering and for hit tests?

Edit: Apple fixed this in iOS8, so it was certainly not expected/intended but a bug. It appears that the zPosition is interpreted differently when used for rendering a node vs when used for determining which node is touched. When I create a…
Pieter
  • 17,435
  • 8
  • 50
  • 89
1
vote
1 answer

iOS - UIScrollView hitTest doesn't contain touches

I have a UIScrollView with UIViews inside it. The UIScrollView has two-finger scroll enabled. The UIViews each have a panGestureRecognizer. I want the following functionality: If two-touch pan --> scroll. If single touch pan && touch on a UIView -->…
rizzes
  • 1,532
  • 20
  • 33
1
vote
1 answer

hitTest:withEvent: is calling sendActionsForControlEvents twice

I have a simple UIButton subclass and I just want to extend the touch area of the button without actually increasing the frame (this is because I want the highlight and selected backgrounds to be the size of the original frame). Here is what I have…
Kyle Begeman
  • 7,169
  • 9
  • 40
  • 58
1
vote
1 answer

Hit-Testing Windows Form graphics

I need to implement hit-testing for my Windows Form Control. I have my custom class which inherits the Control class and I draw, in the OnPaint method, a polyline: e.Graphics.DrawLines(myPen, myPoints); Now, during the MouseDown event I get the…
Nick
  • 10,309
  • 21
  • 97
  • 201
1
vote
3 answers

Hit Testing on Windows Phone 8

I would like to perform Hit Testing on Windows Phone. I found an article about it on MSDN but I am unable to reference HitResult class nor HitTest method. This is the example link from MSDN and contained code: // Respond to the left mouse button…
Jakub Holovsky
  • 6,543
  • 10
  • 54
  • 98
1
vote
1 answer

hitTestObject with Same object, repeatly how to

i am making a game a shootgame, my problem consist in this, my code needs react when the Character hit a tree, in my game i have some tree not one, the trees have the same instance and for that the hitTestObject don't react This is the code what i…
1
vote
1 answer

Can I HitTest element with lower ZIndex in WPF Canvas?

When I am using System.Windows.Media.VisualTreeHelper.HitTest on mouse clicking canvas, it always returns me the element on top. I mean if there are two elements overlapping each other, the one I get is the one with higher ZIndex in canvas. I also…
GoMati
  • 67
  • 2
  • 12
1
vote
2 answers

How to disable hittesting on a WPF window?

I know it is possible - somehow through SetWindowLong API or managed property of WPF's Window class at the moment of window's creation... but how to do that exactly I do not know. I simply cannot find the information of how to set style of a window…
AgentFire
  • 8,944
  • 8
  • 43
  • 90
1
vote
1 answer

How to determine if a UIView has a delegate that conforms to a protocol

I have written a custom class that depends significantly on touch dragging/positioning, outside of it's own view boundaries. There is an associated protocol defined with various relevant methods. An example of something that would use this protocol…
DefenestrationDay
  • 3,712
  • 2
  • 33
  • 61
1
vote
2 answers

What's the best way of doing hit test for irregular-shaped controls in Android?

I am going to implement a customized shape of control like a D-PAD for my Android application. As you can see from the picture, there are 5 control buttons. But everyone knows that a view's touch area is a rectangle. My target is to fire the…
Robin
  • 10,052
  • 6
  • 31
  • 52
1
vote
1 answer

Translating mouse X & Y to 3D model coordinates

I'm building a simple 3D drag and drop interface in processing, and want to detect when the mouse rolls over an object. I would imagine that I need to do some matrix translations to the 3D model coordinates to get them into screen space and so on…
Matti Lyra
  • 12,828
  • 8
  • 49
  • 67
1
vote
1 answer

createJS hit test works in tick event, but not function

This gives output: Lee Xian Sheng label hit function tick(event) { for (var i = 0 ; i < allMyLabels.length; i++) { var pt = allMyLabels[i].globalToLocal(stage.mouseX, stage.mouseY); if (allMyLabels[i].hitTest(pt.x, pt.y)) { …
user3871
  • 12,432
  • 33
  • 128
  • 268
1
vote
0 answers

What ways are there to make a hitbox in AS3?

How many ways are there to create a hit box? I have a Player class, which has a sprite and I want an accurate hitbox for it.