Collision detection method and system
A collision detection and coordinate system technology, which is applied in the field of data analysis and can solve the problems of narrowing the detection range, low accuracy of detection results, and complicated steps.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0042] Please refer to figure 1 , Embodiment 1 of the present invention is:
[0043] A collision detection method provided by the present invention comprises the following steps:
[0044] Establish the two-dimensional coordinate system on the CANVAS canvas of HTML5;
[0045]The relative position and size of the first DOM rectangle structure picture and the second DOM rectangle structure picture are inserted into the CANVAS canvas unchanged;
[0046] Obtain the Alpha values of pixels with the same coordinates in the first DOM rectangle structure picture and the second DOM rectangle structure picture through the API interface of the HTML5, and form the Alpha value pair set; S3: if the Alpha In the value pair set, if there is an Alpha value pair whose two Alpha values are not 0, then the objects represented by the first DOM rectangle structure picture and the second DOM rectangle structure picture collide.
[0047] It can be seen from the above description that if it is de...
Embodiment 2
[0049] In a web game, when a game character is running, there is an irregular or regular obstacle in front of him. At this time, the character cannot penetrate the obstacle when he hits it. Then, whether the character collides with the obstacle, the detection method is as follows : Create a two-dimensional coordinate system on the CANVAS canvas of HTML5; obtain the Alpha values of pixels with the same coordinates in the first DOM rectangle structure picture where the character is located and the second DOM rectangle structure picture where the obstacle is located, and form a set of Alpha value pairs ; If in the Alpha value pair set, there is an Alpha value pair whose two Alpha values are not 0, then the character hits an obstacle, at this moment the person cannot pass through the obstacle, otherwise it will cause interference of different objects, affect the gaming experience.
Embodiment 3
[0051] In the field of web applications, in the field of education, the magnetic field simulator is a subject tool. When the small magnetic needle is dragged, it cannot collide with the magnet. Once it collides, it can continue to move the small magnetic needle. Continue to move the small magnetic needle and the magnet to affect the teaching effect; then whether the small magnetic needle and the magnet collide, you can establish a two-dimensional coordinate system on the HTML5 CANVAS canvas to obtain the first DOM rectangular structure picture where the small magnetic needle is located and the second DOM where the magnet is located The Alpha values of pixels with the same coordinates in the rectangular structure picture form an Alpha value pair set; if there is an Alpha value pair in the Alpha value pair set, the two Alpha values of an Alpha value pair are not 0, then the small magnetic needle and the magnet occur. collision.
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com