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

Hittest for two object shapes

Suppose we have an object with hitbox having an arbitrary complex shape and an object with circle/polygon as a hitbox. How to detect the collisions of these two objects (not the boundary rectangles, but the actual pixels)? Both objects are opaque…
Gulvan
  • 305
  • 2
  • 12
1
vote
4 answers

What's a good way to perform hit testing on a FormattedText?

I'm rendering text using FormattedText, but there does appear to be any way to perform per-char hit testing on the rendered output. It's read-only, so I basically only need selection, no editing. I'd use RichTextBox or similar, but I need to output…
Eric
  • 851
  • 7
  • 16
1
vote
1 answer

SceneView hittest crash on ios 11.4, runs on iOS 12+

I am experiencing a crash of the m_sceneView.hittest(...) function on iOS 11.4. The same code runs on iOS 12+ ! Code looks like this: func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { guard…
Chris
  • 1,231
  • 2
  • 10
  • 20
1
vote
1 answer

Why do I get wrong location coordinates when using hit test in ARKit through RoboVM?

I am trying to develop a test AR app with ARKit using RoboVM. After setting up the session with a ARWorldTrackingConfiguration and running it, I would like to determine a position on a detected horizontal plane (floor) by running a hit test like so:…
nmnd
  • 105
  • 12
1
vote
1 answer

Hit-Testing in WPF for irregularly-shaped items

I have an irregularly shaped item (a line shape) contained within a ContentControl-derived class ("ShapeItem"). I style it with a custom cursor and I handle mouse-clicks within the ShapeItem class. Unfortunately WPF thinks that the mouse is "over"…
Joe
  • 5,394
  • 3
  • 23
  • 54
1
vote
1 answer

clarification needed on document public List hitTest (float xPx, float yPx)

The on-line document on hitTest says: public List hitTest (float xPx, float yPx) .............................. Parameters xPx x coordinate in pixels yPx y coordinate in pixels ................................. However, I do not know in…
Peter Yin
  • 51
  • 1
  • 4
1
vote
1 answer

Hit Test to determine which CGPoint was closest to touch - 16 CGPoint dots in 1 UIView

I've been modifying this custom UIView by LMinh called LMGaugeView in order to make it look like a 16-vial circular "vial carousel". Imagine 16 dots (CGPoints) evenly dispersed around the edge of the circle (UIView). I want to be able to do the…
Anthony_b
  • 23
  • 6
1
vote
0 answers

Swift: How to use Hit Test & Bezier Paths to tap body parts?

I'm trying to recognize where a user taps on a static image of a human body. They may tap the arm, leg, hand, etc and I'll show them that word in another language. Image is static but I'd like it to work on both iPhones and iPads. Any guidance…
devpreneur
  • 139
  • 1
  • 9
1
vote
0 answers

Hittest on canvas

I have a custom view which draws a "pie chart". The initial drawing works fine. Now I want to do some kind of hittest so I know which of the pie segments was touched so that I can rotate the canvas and the touched segment to the top. The problem is…
Patricks
  • 715
  • 2
  • 12
  • 25
1
vote
3 answers

Hit-testing / finding intersection in a distorted rectangular mesh

I have a rectangular mesh that is represented as a bidimensional array of bidimensional points. Something like this (C#-inspired pseudo-code): Point2D[,] mesh = CreateSampleMesh(); mesh.Plot(); Important characteristics are: The mesh is…
1
vote
1 answer

IOS/Objective-C: Call Hit Test Method On View

I cannot find in the documentation how you call the hit test method? Is it called automatically as a delegate method? Or how would you call it? When I put the following code in a VC, it does not fire when you load or tap on the view. Thanks for…
user6631314
  • 1,751
  • 1
  • 13
  • 44
1
vote
1 answer

Does rect.center change rect properties?

Greetings, It seems I am having a bit of trouble with a project I'm working on in pygame. For one of my objects i used: image.get_rect() and assigned it to: self.rect I understand the default coordinates for the get_rect function gives a value of…
user577317
  • 53
  • 8
1
vote
1 answer

Select symbol definition path

I need to view the segments and handles of the path that defines a SymbolItem. It is a related issue to this one but in reverse (I want the behavior displayed on that jsfiddle). As per the following example, I can view the bounding box of the…
1
vote
1 answer

AS3: why would "this" change what it's referring to when inside a function?

My code for each(var enemy in RhythmGame.npcs) { if(this.hitTestObject(enemy)) { enemy.step(distance, axis, origin); enemy.damage(power); } } works fine until I put it in a function separate(); function separate():void { …
to_the_sun
  • 63
  • 6
1
vote
2 answers

In WPF how do I distinguish a mouse hit in a list box item or the scroll bar

I have a WPF list box that contains many items so a scroll bar is shown. I want to add even handler for the user hitting the items but not the scroll bar. How can I do this?
Earth Engine
  • 10,048
  • 5
  • 48
  • 78