Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need input on a possible bug in v3.5.0
#28
@Bplus

Quote:It does look like you want x and y radius of object to minimize scanning though pixels. And isolating an object in an image is interesting problem in itself.


This issue let me remember the solution of progressive decreasing hitbox used in some game engine.
Here an example using the red star

[Image: Decreasing-hitboxing-on-star-Red.png]

As we can observer, there are many squares each of one different color. They are the visual view of a hitbox.
there are 5 special hitboxes that are very close to the edge of image and their color is purple.
In the code we test if the other object is in the first hitbox (yellow in this image) if so, we scan for collision in the areas delimited by purple hitboxes and with the X and Y range between the triggered hitbox and the following hitbox (in this example between Y of yellow square and  Y of green square and using as X the range of X of the purple rectangle surrounding the upper and lower spike of the star), 
and mutatis mutandis we do the same operation on the X dimension: checking if the object to evaluate is between X of yellow square and X of green square we test pixel by pixel collision in the purple area of the right spike and of the left spike limiting to the area between yello square and green square of the 2 (right and left) purple squares. 
If no collision detected the code goes on to evaluate the area between green square and blue square. If again no detection the code goes on to evaluate the area between blue square and orange square and so on until the last square, whose color is light gray in the example. In this square the collision is sure.)
That is an idea to decrease the number of pixels to test.

PS:
moreover if we must reduce drastically the number of tests pixel by pixel , it is very important to use the direction of the movement, that is another tecnique, that joined to this of decreasing hitboxes , powers up the tool of collision detection.
Reply


Messages In This Thread
RE: I need input on a possible bug in v3.5.0 - by TempodiBasic - 01-21-2023, 05:11 PM



Users browsing this thread: 2 Guest(s)