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
2
votes
0 answers

Ellipse hit test?

What is the optimized (avoiding square roots, trigonometry etc.) formula for hit testing given x,y point and ellipse with cx,cy center and width,height? (Ellipse can rotate, but that's not the case.)
madneon
  • 537
  • 3
  • 17
2
votes
1 answer

SceneKit, projecting a node along camera orientation

With SceneKit, I see that a node, to which a camera is attached, has a eulerAngles (SCNVector3 of radian angles) and orientation (SCNQuaternion) My cameraNode is at 0,0,0 and can change its orientation at any moment. I need to do…
David Homes
  • 2,725
  • 8
  • 33
  • 53
2
votes
0 answers

SceneKit rayTestWithSegmentFromPoint, hitResults always nil

Ok this one has had me scratching my head for the past couple of hours. I'm attempting to do raytesting on an SCNScenePhysicsWorld (hitTest in SCNRenderer works without a glitch though) Steps i take: 1.- properties: let scene = SCNScene() var…
David Homes
  • 2,725
  • 8
  • 33
  • 53
2
votes
1 answer

How does one get the front-most layer instead of the deepest layer using HitTest

Well, I just wasted 2 days on that. Simplest example : I have 2 UIView's who's being animated from the top of the screen to the bottom. After a lot of researching i found out that the only way you can "touch/trigger" touch event when UIView is…
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
2
votes
1 answer

Why does the VisualTreeHelper return a border for a button

I am using the VisualTreeHelper to perform a HitTest on a button that looks like this... However…
Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243
2
votes
0 answers

SpriteKit: Determine drawing order for hit test

i am using Spritekit and want to have a hit test, that works intuitive. In other words: I got a position x,y and want to to find out which is the top most node that was hit. (And with "top most" i mean the one that the user actually sees as…
NieLernend
  • 190
  • 9
2
votes
1 answer

'Sprite from Texture' not taking Hit Area Polygon

I have a sprite with a texture defined as follows: // Create sprite spriteObj = new PIXI.Sprite(tileTexture); spriteObj.interactive = true; spriteObj.anchor = new PIXI.Point(0,0.5); spriteObj.click = function(mouseData) { alert("Clicked…
Jordan
  • 904
  • 2
  • 12
  • 32
2
votes
2 answers

NSButton - Hit Testing rollover/hover for custom shaped buttons

(Targeting OS X 10.10, latest version of Xcode) I have an NSButton subclass. The button needs to respond to mouse rollovers/hovers, ala a web button. The button requires an appearance in the shape of a circle. Accordingly, -setImage: and…
Womble
  • 4,607
  • 2
  • 31
  • 45
2
votes
1 answer

Swift (iOS) Create and drag item in one gesture (Passing touch event)

I'm trying to create functionality that will allow users to create a new UIView by touching a TableViewCell and then dragging the newly created UIView to another part of the screen where they can drop it. The problem is, I can accomplish this in…
Ethan Strider
  • 7,849
  • 3
  • 24
  • 29
2
votes
1 answer

Improve hit testing in the visual layer in WPF

I'm using the code below for Hit Testing in the visual layer. I want to get hits when I click on the lines that are drawn in Drawing visual. But since lines are narrow, I'm not getting good results. One solution that comes to my mind is increasing…
Vahid
  • 5,144
  • 13
  • 70
  • 146
2
votes
2 answers

Why is mapping window coordinates to a sphere difficult when the OpenGL camera is at a low altitude (low Z-coordinate)?

I have a sphere (representing Earth) and I want the user to be able to move the mouse while I track the point underneath that mouse location on the sphere. Everything works fine as long as the camera is at a reasonable altitude from the surface of…
user541686
  • 205,094
  • 128
  • 528
  • 886
2
votes
1 answer

Handling touchesBegan in the main view - how to get ahold of the touched subview?

In an single view iPhone app I have the following structure: scrollView -> contentView -> imageView and underneath (at the main view) there are 7 draggable custom views - which can be dragged from/to the contenView. Initially dragging was handled in…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
2
votes
2 answers

Html5 canvas hittest arbitrary shape

I'm trying to develop program which can render images and text in canvas. I tried to handle click on image in canvas, but it work for rectable images. My question: Did you know solution or frameworks for handle click on visible part of image (not…
Anton Rodin
  • 991
  • 2
  • 12
  • 19
2
votes
2 answers

Test if Cube is inside Sphere - Fastest Method

Is there a faster way to check if an axis aligned cube is inside a sphere than to test separately if the 8 corners are inside the Sphere? I'm walking through an Octree checking if its cube-leafs are intersecting or enclosed within a Sphere. I found…
BoshWash
  • 5,320
  • 4
  • 30
  • 50
2
votes
2 answers

hitTestPoint with 'shapeFlag=true' doesn't work in AS3

I simply added a sprite in AS3: Sprite myspr = new Sprite(); myspr.addChild(mybitmap); addChild(myspr); Then I added an event. I did hitTestPoint for checking mouse is over my sprite or not. stage.addEventListener(MouseEvent.MOUSE_MOVE,…
mhmtemnacr
  • 185
  • 3
  • 18