A first-person perspective roaming method for Web-based massive spatial data

By implementing the first-person perspective roaming method under massive spatial data on the web, combining ray collision detection and physical simulation, the problems of low roaming efficiency and unrealistic physical characteristic simulation in traditional methods are solved, and efficient and realistic first-person perspective is achieved roaming.

CN115937476BActive Publication Date: 2024-11-15CHANGJIANG SPATIAL INFORMATION TECH ENG CO LTD (WUHAN)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211615175.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-15
Publication Date
2024-11-15
Estimated Expiration
2042-12-15

AI Technical Summary

Technical Problem

Under massive spatial data, traditional methods are difficult to achieve efficient and realistic first-person roaming on the web, especially when considering factors such as collision, gravity, and jumps, which often lead to rendering lag and low frame rates.

Method used

A first-person perspective roaming method on the web end under massive spatial data is adopted, and the camera posture and position are updated through initialization settings and loops, combining ray collision detection and physical simulation to achieve smooth and efficient roaming. The method includes setting of roaming parameters, setting of interactive operation items, monitoring with mouse and keyboard operation, dynamic update of camera speed and position, and taking into account physical characteristics such as gravity acceleration and jumping.

Benefits of technology

In a low hardware resource environment, efficient and realistic first-person roaming is achieved, with a stable frame rate of more than 30 frames, meeting the needs of real-time and fluency, and solving the low frame rate and physical characteristics simulation during roaming in traditional methods. Unreal problem.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115937476B_ABST
    Figure CN115937476B_ABST
Patent Text Reader

Abstract

The present invention discloses a first-person perspective roaming method for a Web terminal under massive spatial data. The method comprises the following steps: step 1: initializing the first-person perspective roaming; step 2: roaming in the first-person perspective, starting to monitor the roaming operation and dynamically updating the camera posture and position in a loop; step 3: pressing the end command, turning off the mouse, keyboard and other event responses, turning off the roaming loop logic, and ending the first-person perspective roaming process. The present invention overcomes the defect that the traditional method cannot realize realistic, real-time and efficient first-person perspective roaming; and has the advantage of being able to realize realistic, real-time and efficient first-person perspective roaming.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional visualization and space roaming, and specifically, it is a first-person perspective roaming method for a Web terminal under massive spatial data. More specifically, it is a first-person perspective roaming method that supports three-dimensional spatial data, runs in a Web terminal environment, and considers factors such as physical collision, gravity, and jumping. Background Art

[0002] With the continuous development of 3DGIS, BIM and virtual reality technology, its application fields are becoming more and more extensive. The three-dimensional virtual space scene provides users with a virtual environment with realistic effects and intuitive images. As an important part of the three-dimensional space visualization and user interaction, the three-dimensional scene roaming provides walking or flying roaming from the observer's perspective, realizing interactive quick browsing and detailed viewing of the scene. According to the different observation perspectives, the three-dimensional scene roaming can be divided into first-person perspective and third-person perspective roaming. Among them, the first-person perspective roaming browses the three-dimensional virtual scene from the observer's perspective, has a more intuitive and immersive roaming experience, can observe the subtle details in the scene, and is more widely used.

[0003] In the first-person roaming process of a three-dimensional scene, in order to realistically simulate the interactive dynamics of people in the three-dimensional scene, it is necessary to consider factors such as collision detection, gravity drop, jumping, and climbing. This involves a large amount of data reading, computer graphics calculations, and logical judgments, which consumes considerable hardware resources and easily causes the rendering and visualization process to freeze. Conventional first-person perspective roaming functions are mostly used on desktops with higher resource call and response efficiency. They are implemented using complex model bounding box collision detection and physical simulation engines. Usually, the three-dimensional scene is small or the amount of spatial data is limited to ensure operation efficiency. In the increasingly widely used Web three-dimensional applications, especially in the field of GIS+BIM large-scale multi-scale visualization technology, the three-dimensional scenes are complex and the data is massive. Due to the low resource call efficiency of the Web end and the limitations of lightweight hardware devices, the traditional method cannot achieve realistic, real-time, and efficient first-person perspective roaming.

[0004] Therefore, it is necessary to develop a first-person perspective roaming method on the Web under massive spatial data. Summary of the invention

[0005] The purpose of the present invention is to provide a first-person perspective roaming method for a Web terminal under massive spatial data, which is an efficient first-person perspective roaming method that supports large amounts of spatial data and runs in a Web environment. The present invention fully considers many factors such as collision, gravity, jumping, acceleration and deceleration, and while breaking through the limitations of the low operating efficiency and slow response speed of the Web terminal itself, it can achieve realistic, real-time, efficient and smooth first-person perspective walking and flying roaming.

[0006] In order to achieve the above object, the technical solution of the present invention is: a first-person perspective roaming method for a Web terminal under massive spatial data, characterized in that it includes the following steps:

[0007] Step 1: Initialize the first-person perspective roaming settings;

[0008] Step 2: Perform first-person perspective roaming, start monitoring roaming operations and dynamically update the camera posture and position in a loop;

[0009] Step 3: Press the end command to turn off the mouse, keyboard and other event responses, turn off the roaming loop logic, and end the first-person perspective roaming process.

[0010] In the above technical solution, in step 1, the first-person perspective roaming initialization settings include roaming parameter settings and interactive operation item settings;

[0011] It includes the following sub-steps:

[0012] Step 1.1, perform roaming parameter initialization settings, including general roaming parameter settings and special parameter settings for two different modes, walking and flying, respectively;

[0013] Step 1.2, initializing the interactive operation items, including initializing the mouse and keyboard operation items, to specify the specific keys for interactive operations during roaming.

[0014] In the above technical solution, in step 1, the general roaming parameters are set to include the maximum and minimum pitch angles maxPitch and minPitch, the collision detection distance tolerance collisionToler, and the mouse operation sensitivity poseSens;

[0015] The flight roaming parameter settings include the flight displacement base speed flyBaseSpeed, the flight displacement acceleration flyAcceler and the flight displacement maximum speed flyMaxSpeed;

[0016] The walking roaming parameter settings include person height personHeight, person line of sight height eyeHeight, walking horizontal displacement basic speed walkBaseSpeed, walking horizontal displacement acceleration walkAcceler, walking horizontal displacement maximum speed walkMaxSpeed, gravity vertical displacement acceleration gravityAcceler and jumping vertical displacement initial speed jumpSpeed.

[0017] In the above technical solution, in step one, the specific mouse operation items in the specific buttons for interactive operations during roaming are specified as follows: horizontal and vertical sliding of the mouse controls the azimuth and pitch angle of the line of sight; the keyboard operation items are as follows: pressing the W key, S key, A key and D key to control the viewpoint to move forward, backward, left and right, the Shift key to accelerate, the Q key and E key to lower or raise the viewpoint height, the T key to turn on or off collision detection, the Space key to jump in walking mode, and the F key to cut flowers, fly and walk roaming mode.

[0018] In the above technical solution, in step 2, roaming from the first-person perspective is performed, the operation monitoring of the roaming mouse, keyboard, etc. is turned on to start monitoring the roaming operation and dynamically update the camera posture and position in a loop, and record all mouse and keyboard roaming operation states; the subsequent roaming process of dynamic changes in the camera posture and position is performed in a loop;

[0019] It includes the following sub-steps:

[0020] Step 2.1, start the roaming mouse, keyboard and other operation monitoring, record all mouse and keyboard roaming operation status, including the following sub-steps:

[0021] Step 2.1.1, the browser enters PointerLock mode, the mouse cursor disappears, and the mouse can slide infinitely without being affected by the screen range; then turn on the mousemove event listener. When the mouse slides, the mouse sliding transformation movement can be obtained, where the horizontal displacement of the mouse is movement.movementX, and the vertical displacement is movement.movementY;

[0022] Step 2.1.2, open the keyboard press (keydown) and release (keyup) event monitoring, when the W, S, A, D, Q, E, Shift and other operation keys are pressed or released, the variables wPress, sPress, aPress, dPress, qPress, ePress, shiftPress are synchronously set to 1 or 0; after pressing T, the variable collisionTest = ! collisionTest is used to switch whether to perform collision detection during roaming (initialize collisionTest = true); after pressing Space, if the current mode is walking and the person is on the ground, jump (set the vertical upward initial speed to verticalSpeed ​​= jumpSpeed); after pressing F, the variable walkMode = ! walkMode is used to switch between walking roaming and flying roaming modes (initialize walkMode = true);

[0023] Step 2.2, after turning on the roaming operation monitoring, the subsequent roaming process is continuously looped. The loop can be performed in each rendering frame or according to a fixed interval deltaTime; in each post-roaming loop, the mouse and keyboard operations are detected once, and the camera is updated accordingly. By continuously looping this process, smooth 3D scene roaming can be achieved.

[0024] In the above technical solution, smooth three-dimensional scene roaming is achieved, which specifically includes the following sub-steps:

[0025] Step 2.2.1, at the beginning of each roaming cycle, update the roaming speed value according to the roaming operation, and generate the camera change caused by mouse, keyboard operation and gravity acceleration (Note: gravity acceleration is only considered in walking roaming mode, and flying roaming is similar to drone hovering, so gravity is not considered); the camera change caused is specifically divided into: camera attitude change caused by mouse sliding, camera position change caused by keyboard operation and gravity acceleration;

[0026] Step 2.2.2, judging the camera attitude change and position change generated in the previous step of step 2.2.1, and generating new camera attitude value and camera position value accordingly;

[0027] Step 2.2.3, according to the new camera posture (newHeading, newPitch) and camera position (newCameraPosition) generated in step 2.2.2, set the camera parameters to update the camera posture and position; then return to step 2.2.1 to perform the next cycle of roaming process;

[0028] By repeating this process (i.e., step 2.2.1 to step 2.2.3) continuously, smooth and efficient first-person perspective flying and walking roaming can be performed continuously.

[0029] In the above technical solution, in step 2.2.1, generating the camera change caused includes the following sub-steps:

[0030] Step 2.2.1.1: In this roaming cycle, dynamically update the roaming speed parameters according to the keyboard Shift and Space operation key status and gravity acceleration; if it is flying roaming mode, go to step 2.2.1.1.1; if it is walking roaming mode, go to step 2.2.1.1.2:

[0031] Step 2.2.1.1.1, update the flight roaming displacement speed, realize the Shift key progressive acceleration, the roaming speed update calculation formula is shown in the following formula (1) and formula (2); where flyAcceler is the flight roaming acceleration; deltaTime is the cycle interval time; flyBaseSpeed ​​is the flight roaming basic displacement speed; flyMaxSpeed ​​is the flight roaming maximum speed; flySpeed ​​is the updated flight roaming displacement speed:

[0032]

[0033]

[0034] Step 2.2.1.1.2, update the horizontal displacement speed of walking roaming to realize the gradual acceleration of the Shift key; update the vertical displacement speed of flying roaming to realize gravity falling and jumping; the calculation formula of the horizontal displacement speed of walking is similar to the calculation in step 2.2.1.1.1, as shown in the following formulas (3) and (4); where walkAcceler is the acceleration of flying roaming; deltaTime is the cycle interval time; walkBaseSpeed ​​is the basic displacement speed of flying roaming; walkMaxSpeed ​​is the maximum speed of flying roaming; hSpeed ​​is the updated horizontal displacement speed of walking roaming:

[0035]

[0036]

[0037] The calculation formula of walking vertical displacement speed is shown in the following formula (5); where vSpeed ​​is the walking vertical displacement speed. When colliding with the ground or the top surface, it is directly assigned to 0 (performed in the subsequent collision detection step); when on the ground (onGround=true) and the Space button is pressed, it is assigned to the initial jump speed jumpSpeed ​​(performed in the subsequent collision detection step); in other cases, gravity acceleration calculation is performed, gravityAcceler is the gravity acceleration; deltaTime is the loop interval time:

[0038]

[0039] Step 2.2.1.2, according to the displacement value generated by the mouse sliding event (mousemove), calculate the posture change that the camera should produce; among which, the horizontal displacement of the mouse movementX is converted into the camera azimuth angle change deltaHeading; the vertical displacement movementY is converted into the camera pitch angle change deltaPitch; the calculation formula is shown in the following formula (6) and formula (7):

[0040]

[0041]

[0042] Where: screenWidth and screenHeight are the width and height of the 3D scene screen respectively, poseSens is the camera posture change sensitivity set in the previous step, deltaHeading and deltaPitch are the camera azimuth and pitch angle change results;

[0043] Step 2.2.1.3, calculate the position change that the camera should generate based on the events of pressing (keydown) and releasing (keyup) W, S, A, D, Q, and E on the keyboard; the calculation of the position change is different for the two different modes of flying and walking. If it is flying, go to step 2.2.1.3.1; if it is walking, go to step 2.2.1.3.2:

[0044] Step 2.2.1.3.1, calculate the camera position change in the flight roaming mode, the calculation formula is shown in the following formula (8) and formula (9):

[0045]

[0046] step=flySpeed×deltaTime (9)

[0047] In the formula, They are the forward, right, and upward direction vectors of the roaming camera, which are directly obtained according to the current camera posture of the scene; wPress, sPress, dPress, aPress, ePress, and qPress are the record variables of whether each roaming operation button described in the previous step is pressed, and the value is 0 (not pressed) or 1 (pressed); normalize() is the vector normalization processing; step is the step value of the camera displacement; flySpeed ​​is the flight roaming speed (obtained from the basic flight speed and acceleration operation, see step 2.2.1.1.1 for details); deltaTime is the loop interval time; Then is the calculated camera displacement result vector;

[0048] Step 2.2.1.3.2, calculate the camera position change in walking roaming mode. The walking position change is composed of the horizontal displacement caused by keyboard manipulation and the vertical displacement caused by gravity acceleration (taking jumping into account). The horizontal displacement calculation formula is shown in the following equations (10) and (11):

[0049]

[0050] hStep=hSpeed×deltaTime (11)

[0051] In the formula, wPress, sPress, dPress, aPress, normalize() are the same as in step 2.2.1.2.1; hStep is the horizontal displacement step length; hSpeed ​​is the horizontal speed of walking (obtained from the basic walking speed and acceleration operation, see step 2.2.1.1.2 for details); is the horizontal displacement result vector;

[0052] The vertical displacement calculation formula is shown in the following formula (12), where vSpeed ​​is the vertical displacement speed of walking roaming (obtained by gravity acceleration and jump operation, etc., see step 2.2.1.1.2 for details); deltaTime is the cycle interval time; is the result vector of vertical displacement;

[0053]

[0054] The camera displacement vector after integrating the horizontal displacement value and the vertical displacement value is calculated as shown in the following formula (13), where That is the camera displacement result vector;

[0055]

[0056] In the above technical solution, in step 2.2.2, a new camera posture value and camera position value are generated, which specifically includes the following sub-steps:

[0057] Step 2.2.2.1, calculate and judge the new camera attitude value according to the camera attitude change deltaHeading and deltaPitch, so that after adding the transformation, the camera attitude parameters are within the valid range (newHeading value range is [0, 360), newPitch value range is [minPitch, maxPitch]), the calculation formula is shown in the following formula (14) and formula (15):

[0058] newHeading=(360+(heading+deltaHeading)%360)%360 (14)

[0059]

[0060] Step 2.2.2.2: Perform ray collision detection on the new camera position value according to the camera position change to determine whether the camera can reach the position. The process is different for flying and walking. The flying process goes to step 2.2.2.2.1, and the walking process goes to step 2.2.2.2.2:

[0061] Step 2.2.2.2.1, in the flying roaming mode, according to the current camera position cameraPosition and the camera position change generated by the previous step Perform ray collision detection on the scene to determine whether the camera position change is feasible; if the displacement does not collide with the scene, the camera position will be updated; if the displacement collides, the camera position remains unchanged, and the flight roaming speed flySpeed ​​is assigned to flyBaseSpeed, and the Shift key is stopped to accelerate; the new camera position is calculated as shown in the following formula (16):

[0062]

[0063] Step 2.2.2.2.2, in walking roaming mode,

[0064] Step 2.2.2.2.2.1, based on the current camera position camerαPosition and the camera horizontal and vertical position changes generated by the previous steps and Perform ray collision detection on the scene (similar to step 2.2.2.2.1) to determine whether the position change is feasible If it is feasible, continue with the subsequent steps; if it is not feasible, the camera position remains unchanged, exit the current step, and go directly to step 2.2.3;

[0065] Step 2.2.2.2.2.2, according to the changed camera position cameraPosition′, perform downward and upward ray collision detection to further ensure that the new camera position longitudinal space can accommodate the roaming personnel; first perform downward ray collision detection, and the distance threshold downColliDis of the downward detection is set to the personnel's line of sight height value eyeHeight (if it exceeds this distance range, the scene objects will not hinder the roaming, so no detection is required); within the distance threshold, if the ray intersects with the ground, the intersection is recorded as groundp′ and the corresponding distance value is recorded as groumdDis; if there is no intersection, groundDis takes the maximum value Double.MAX_VALUE;

[0066] The upward ray detection distance threshold upColliDis = Max(personHeight-eyeHeight, personHeight-groundDis) is used to ensure that the head does not collide with the top; if there is no intersection within the distance threshold in the upward collision detection, it means that the longitudinal space of the camera position cameraPosition′ can accommodate the roaming person, so the subsequent steps are entered; otherwise, it means that a collision occurs on the top of the head, and vSpeed ​​is assigned a value of 0, so that the jump directly falls after hitting the head (see step 2.2.1.1.2 formula (5), if a collision occurs in the longitudinal upward detection, it means that the top has hit an obstacle, no matter what the previous upward movement speed is, the speed needs to be directly reset to 0, formula (5) completes this setting, for example: after taking off, hitting the ceiling will stop rising), and exit the current step and directly enter step 2.2.3:

[0067] Step 2.2.2.2.2.3, if the longitudinal space can accommodate the roaming personnel, then according to cameraPosition′, check whether there is a ground intersection point grounddlP′ and the intersection distance value groundDis, and further generate the result camera position newCameraPosition; and in this step, if there is a ground intersection point, it means that the person has landed, then vSpeed ​​is assigned to 0, and onGround is assigned to true to stop gravity acceleration falling (see step 2.2.1.1.2 formula (5)); if there is no ground intersection point, it means that the person is in mid-air, then onGround is assigned to false, so that the jump cannot be triggered, and the response of the Space jump key is stopped; the camera position calculation is shown in the following formula (17):

[0068]

[0069] Compared with the prior art, the present invention has the following advantages:

[0070] (1) The method of the present invention meets the application requirements of first-person perspective roaming of three-dimensional scenes on the Web side in an environment with massive spatial data volume (i.e., the number of three-dimensional facets within the screen viewing angle range reaches more than tens of millions), filling the technical gap of efficient and realistic three-dimensional roaming on the Web side with relatively low hardware resource occupation; the implementation strategy of the entire collision detection and physical simulation in the method of the present invention has a small amount of calculation, fast roaming speed, and strong versatility (the strategy of the method of the present invention can be applied to any three-dimensional application that supports ray detection, and does not require other complex algorithm support), and is worthy of application and promotion;

[0071] (2) The method of the present invention uses fast ray collision detection, combined with strict judgment logic, to achieve efficient roaming of complex three-dimensional scenes taking into account physical collision-free penetration while taking into account the efficiency and effect of roaming. The algorithm is more efficient, and while breaking through the limitations of low operating efficiency and slow response speed of the Web end itself, it can achieve realistic, real-time, efficient and smooth first-person perspective walking and flying roaming; it solves the large number of complex calculation problems involved in the collision detection strategy during the roaming of three-dimensional scenes, and at the same time solves the problem that the existing technology maintains a running screen frame rate of less than 10 frames when achieving realistic first-person roaming taking into account collision, gravity, jumping, acceleration and deceleration, resulting in obvious freezes, making it difficult to meet the requirements of smooth use, and cannot meet the real simulation of the physical characteristics of the roaming, and cannot ensure the real-time and efficient performance of the first-person roaming;

[0072] (3) The method described in the present invention provides two roaming modes: flying (such as drones and other aircraft) and walking. The two roaming modes can be switched freely during the roaming process, and collision detection can also be dynamically turned off. The application is more flexible and convenient, and is more closely in line with the usage requirements of large-scale multi-scale three-dimensional space roaming. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 This is a flow chart of the present invention during three-dimensional roaming from a first-person perspective.

[0074] Figure 2 Schematic diagram of flight and walking roaming parameters in an embodiment of the present invention.

[0075] Figure 3 Schematic diagram of sliding displacement of a mouse screen in an embodiment of the present invention.

[0076] Figure 4 Schematic diagram of the pitch angle and azimuth angle range of the camera in an embodiment of the present invention.

[0077] Figure 5 Schematic diagram of flight roaming collision detection in an embodiment of the present invention.

[0078] Figure 6Schematic diagram of the pedestrian roaming collision detection (with ground intersection) step in an embodiment of the present invention.

[0079] Figure 7 Schematic diagram of the pedestrian roaming collision detection (no ground intersection) step in an embodiment of the present invention.

[0080] Figure 8 Schematic diagram of a first-person perspective roaming operation interface in an embodiment of the present invention.

[0081] Figure 2 Figure ① shows the parameters involved in the flight roaming;

[0082] Figure 2 Figure ② shows the parameters involved in walking roaming.

[0083] Figure 5 Figure ① shows the flight roaming collision detection when the camera has no collision;

[0084] Figure 5 Figure ② shows the flying roaming collision detection when the camera has a collision.

[0085] Figure 6 Figure ① in the figure shows the camera's forward collision detection, and the new camera position without collision is obtained;

[0086] Figure 6 Figure ② shows the vertical collision detection of the new camera position, which determines whether the vertical space of the new position can accommodate the roaming character;

[0087] Figure 6 Figure ③ in the figure shows that the camera result position is determined based on the vertical detection of the ground collision point and the size of the roaming character, and the camera is updated to this position.

[0088] Figure 7 Figure ① in the figure shows the camera's forward collision detection, and the new camera position without collision is obtained;

[0089] Figure 7 Figure ② shows the vertical collision detection of the new camera position, which determines whether the vertical space of the new position can accommodate the roaming character;

[0090] Figure 7 Figure ③ in the figure shows that the camera result position is determined based on the vertical detection of the ground collision point and the size of the roaming character, and the camera is updated to this position.

[0091] Figure 8 Figure (a) shows the flying roaming mode; Figure 8 Figure (b) shows the walking roaming mode; Figure 8 The cross cursors in (a) and (b) indicate the current camera viewpoint. DETAILED DESCRIPTION

[0092] The following is a detailed description of the implementation of the present invention in conjunction with the accompanying drawings, but they do not constitute a limitation of the present invention and are only given as examples. At the same time, the advantages of the present invention are made clearer and easier to understand through the description.

[0093] The present invention provides a first-person perspective roaming method for a Web terminal under massive spatial data, which uses a simple, fast and stable collision detection strategy, combined with gravity, jumping, acceleration and deceleration and other physical characteristics simulation, to complete fast first-person perspective realistic flight and walking roaming in complex Web three-dimensional scenes. The roaming process of the present invention uses a fast ray collision detection strategy, combined with strict judgment logic, and realizes collision-free and non-penetration roaming under the premise of taking into account the efficiency and effect of roaming; the roaming takes into account multiple physical factors such as gravity acceleration, jumping, acceleration and deceleration, and combined with the diversified operations of the keyboard and mouse, it can realistically and flexibly simulate the immersive browsing effect of the first-person perspective; it can realize high-efficiency, low hardware resource occupation first-person perspective interactive roaming in complex Web three-dimensional scenes; it overcomes the defect that the existing technology cannot realize realistic, real-time and efficient first-person perspective roaming.

[0094] The core problem to be solved by the present invention is: in a Web three-dimensional scene containing a large amount of model data, with lower hardware resource consumption, a faster and more realistic interactive experience, and efficient first-person perspective flying and walking roaming that takes into account multiple physical quantities such as collision, gravity, jumping, acceleration and deceleration control.

[0095] Example

[0096] The present invention is now described in detail by taking the application of the present invention to a three-dimensional scene of a massive spatial data for first-person perspective roaming on a Web as an example, and it also has a guiding role in applying the present invention to other three-dimensional scenes of massive spatial data for first-person perspective roaming on a Web.

[0097] The three-dimensional scene on the Web constructed in this embodiment includes buildings, landforms, and BIM refined structural components inside the building, and the number of three-dimensional facets within the screen viewing angle reaches more than 10 million. The collision detection method of the outer contour polyhedron intersection traditionally used for the desktop (the desktop cannot be shared, exists in the form of a Windows window, does not require a browser, and runs through a desktop application) is adopted (for example, the method described in the application number 201711244096.6 and the patent name is "3D roaming collision detection method supporting massive spatial data"). When realizing realistic first-person roaming that takes into account collision, gravity, jumping, acceleration and deceleration, the running screen frame rate is maintained below 10 frames, resulting in obvious jams, which is difficult to meet the needs of smooth use, and cannot meet the real simulation of the physical characteristics of roaming, and at the same time cannot guarantee the real-time and high efficiency of the first-person roaming.

[0098] The method of the present invention compromises between efficiency and simulation effect, and considers and optimizes the method strategy. The present invention takes into account collision, gravity, jumping, acceleration and deceleration, etc. in the Web-side three-dimensional scene constructed in this embodiment, and the frame rate of the first-person roaming screen is stably maintained at more than 30 frames, which not only ensures the true simulation of the roaming physical characteristics, but also meets the requirements of the Web-side (the Web-side requires a browser to execute, exists in the form of a web page, and only needs to be installed once on the server, and can be shared with all clients through the network, which can achieve maximum resource sharing) in an environment where the efficiency of software and hardware resource calling is limited. The real-time, efficient and smooth roaming greatly improves the interactive experience of the three-dimensional scene.

[0099] like Figure 1 As shown, this embodiment adopts the Web-side first-person perspective roaming method under massive spatial data of the present invention to perform Web-side first-person perspective roaming. The specific method includes the following steps:

[0100] Step 1: Initialize the first-person perspective roaming settings, including roaming parameter settings and interactive operation item settings, which are divided into the following sub-steps:

[0101] Step 1.1, initialize the roaming parameters, including general roaming parameter settings, and special parameter settings for walking and flying modes, and set them separately. The general roaming parameter settings include the maximum and minimum pitch angles maxPitch and minPitch, the collision detection distance tolerance collisionToler, and the mouse operation sensitivity poseSens; the flying roaming parameter settings include the flight displacement base speed flyBaseSpeed, the flight displacement acceleration flyAcceler, and the flight displacement maximum speed flyMaxSpeed; the walking roaming parameter settings include the person height personHeight, the person line of sight height eyeHeight, the walking horizontal displacement base speed walkBaseSpeed, the walking horizontal displacement acceleration walkAcceler, the walking horizontal displacement maximum speed walkMaxSpeed, the gravity vertical displacement acceleration gravityAcceler, and the jumping vertical displacement initial speed jumpSpeed. Some parameters are as follows Figure 2 As shown, Figure 2 Figure ① shows the flight parameters. Figure 2 ② in the figure is walking roaming parameters. The specific roaming parameter setting instructions and the setting values ​​in this embodiment are shown in the following Table 1:

[0102] Table 1 Setting values ​​in this embodiment

[0103]

[0104]

[0105] Step 1.2, initialize the interactive operation items, including the initialization settings of the mouse and keyboard operation items, to specify the specific keys for interactive operations during roaming. The specific mouse operation items are: horizontal and vertical sliding of the mouse controls the azimuth and pitch angle of the line of sight; the keyboard operation items are: press the W key, S key, A key, and D key to control the viewpoint to move forward, backward, left, and right, the Shift key to accelerate, the Q key and E key to lower or raise the viewpoint height, the T key to turn on or off collision detection, the Space key to jump in walking mode, and the F key to cut flowers, fly, and walk roaming mode. The specific interactive operation instructions are shown in Table 2 below:

[0106] Table 2 Interactive operation description in this embodiment

[0107]

[0108]

[0109] Step 2: Perform first-person perspective roaming, start monitoring roaming operations and dynamically update the camera posture and position in a loop: start monitoring roaming mouse, keyboard and other operations; and roam in a loop with subsequent dynamic changes in camera posture and position. This includes the following sub-steps:

[0110] Step 2.1, start the roaming mouse, keyboard and other operation monitoring, record all mouse and keyboard roaming operation status, including the following sub-steps:

[0111] Step 2.1.1, the browser enters PointerLock mode, the mouse cursor disappears, and the mouse can slide infinitely without being affected by the screen range; then turn on the mousemove event listener. When the mouse slides, the mouse sliding transformation movement can be obtained, where the horizontal displacement of the mouse is movement.movementX, and the vertical displacement is movement.movementY;

[0112] Step 2.1.2, open the keyboard press (keydown) and release (keyup) event monitoring, when the W, S, A, D, Q, E, Shift and other operation keys are pressed or released, the variables wPress, sPress, aPress, dPress, qPress, ePress, shiftPress are synchronously set to 1 or 0; after pressing T, the variable collisionTest = ! collisionTest is used to switch whether to perform collision detection during roaming (initialize collisionTest = true); after pressing Space, if the current mode is walking and the person is on the ground, jump (set the vertical upward initial speed to verticalSpeed ​​= jumpSpeed); after pressing F, the variable walkMode = ! walkMode is used to switch between walking roaming and flying roaming modes (initialize walkMode = true);

[0113] Step 2.2, after the roaming operation monitoring is turned on, the subsequent roaming process is continuously looped. The loop can be performed in each rendering frame or according to a fixed interval deltaTime. In this embodiment, for the convenience of description, we use a fixed interval deltaTime of 10 milliseconds to perform the roaming cycle, that is, every 10 milliseconds, the mouse and keyboard operations are detected, and the camera is updated accordingly. This process is continuously looped to achieve smooth 3D scene roaming. It specifically includes the following sub-steps:

[0114] Step 2.2.1, at the beginning of each roaming cycle, update the roaming speed value according to the roaming operation, and generate the camera change caused by mouse, keyboard operation and gravity acceleration (Note: gravity acceleration is only considered in walking roaming mode, and flying roaming is similar to drone hovering, so gravity is not considered). Specifically divided into: camera attitude change caused by mouse sliding, camera position change caused by keyboard operation and gravity acceleration. It includes the following sub-steps:

[0115] Step 2.2.1.1: In this roaming cycle, dynamically update the roaming speed parameters according to the keyboard Shift and Space operation key status and gravity acceleration. If it is a flying roaming mode, go to step 2.2.1.1.1; if it is a walking roaming mode, go to step 2.2.1.1.2:

[0116] Step 2.2.1.1.1, update the flight roaming displacement speed, realize the Shift key progressive acceleration, the roaming speed update calculation formula is as follows (specific initial values ​​are shown in Table 1, and the subsequent values ​​are iteratively changed at every moment with the iteration time and operation. For example, after pressing the accelerator key, the flight roaming speed will continue to increase, etc.). Among them, flyAcceler is the flight roaming acceleration; deltaTime is the cycle interval time; flyBaseSpeed ​​is the flight roaming basic displacement speed; flyMaxSpeed ​​is the flight roaming maximum speed; flySpeed ​​is the updated flight roaming displacement speed:

[0117]

[0118]

[0119] Step 2.2.1.1.2, update the horizontal displacement speed of walking roaming to achieve gradual acceleration with the Shift key; update the vertical displacement speed of flying roaming to achieve gravity falling and jumping. The calculation formula for the horizontal displacement speed of walking is similar to the calculation in step 2.2.1.1.1, as shown below. Where walkAcceler is the acceleration of flying roaming; deltaTime is the cycle interval time; walkBaseSpeed ​​is the basic displacement speed of flying roaming; walkMaxSpeed ​​is the maximum speed of flying roaming; hSpeed ​​is the updated horizontal displacement speed of walking roaming:

[0120]

[0121]

[0122] The calculation formula for the vertical displacement speed of walking is as follows, where vSpeed ​​is the vertical displacement speed of walking roaming. When colliding with the ground or the top surface, it is directly assigned to 0 (performed in the subsequent collision detection step); when on the ground (nGround = true) and the Space button is pressed, it is assigned to the initial jump speed jumpSpeed ​​(performed in the subsequent collision detection step); in other cases, gravity acceleration calculation is performed, gravityAcceler is the gravity acceleration; deltaTime is the loop interval time:

[0123]

[0124] Step 2.2.1.2, based on the displacement value generated by the mouse sliding event (mousemove), calculate the attitude change that the camera should generate. The horizontal displacement of the mouse movementX is converted into the camera azimuth change deltaHeading; the vertical displacement movementY is converted into the camera pitch angle change deltaPitch. The calculation formula is as follows:

[0125]

[0126]

[0127] Where screenWidth and screenHeight are the width and height of the 3D scene screen respectively. Figure 3 As shown in the figure, poseSens is the camera posture change sensitivity set in the previous step, and deltaHeading and deltaPitch are the camera azimuth and pitch angle change results.

[0128] Step 2.2.1.3, calculate the position change that the camera should generate based on the events of pressing (keydown) and releasing (keyup) W, S, A, D, Q, and E on the keyboard. The calculation of the position change is different for the two different modes of flying and walking. If it is flying, go to step 2.2.1.3.1; if it is walking, go to step 2.2.1.3.2:

[0129] Step 2.2.1.3.1, calculate the camera position change in the flight roaming mode, the calculation formula is as follows:

[0130]

[0131] step=flySpeed ​​× deltaTime(9)

[0132] In the formula, They are the forward, right, and upward direction vectors of the roaming camera, which are directly obtained according to the current camera posture of the scene; wPress, sPress, dPress, aPress, ePress, and qPress are the record variables of whether each roaming operation button described in the previous step is pressed, and the value is 0 (not pressed) or 1 (pressed); normalize() is the vector normalization processing; step is the step value of the camera displacement; flySpeed ​​is the flight roaming speed (obtained from the basic flight speed and acceleration operation, see step 2.2.1.1.1 for details); deltaTime is the loop interval time; is the calculated camera displacement result vector.

[0133] Step 2.2.1.3.2, calculate the camera position change in walking roaming mode. The walking position change is composed of the horizontal displacement caused by keyboard manipulation and the vertical displacement caused by gravity acceleration (considering jumping). The calculation formula for horizontal displacement is as follows:

[0134]

[0135] hStep=hSpeed×deltaTime (11)

[0136] In the formula, wPress, sPress, dPress, aPress, normnalize() are the same as those in step 2.2.1.2.1; hhStep is the horizontal displacement step length; hSpeed ​​is the horizontal speed of walking (obtained from the basic walking speed and acceleration operation, see step 2.2.1.1.2 for details); is the horizontal displacement result vector.

[0137] The vertical displacement calculation formula is as follows: vSpeed ​​is the vertical displacement speed of walking (obtained by gravity acceleration and jump operation, etc., see step 2.2.1.1.2 for details); deltaTime is the loop interval time; is the result vector of vertical displacement.

[0138]

[0139] The camera displacement vector calculation after integrating the horizontal displacement value and the vertical displacement value is shown in the following formula, where This is the camera displacement result vector.

[0140]

[0141] Step 2.2.2, judge the camera attitude change and position change generated in the previous step, and generate a new camera attitude value accordingly, which specifically includes the following sub-steps:

[0142] Step 2.2.2.1, calculate and judge the new camera attitude value according to the camera attitude change deltaHeading and deltaPitch, so that after adding the transformation, the camera attitude parameters are within the valid range (newHeading value range is [0, 360), newPitch value range is [minPitch, maxPitch], in this embodiment is [-85, 85], see Figure 4 ), the calculation formula is as follows:

[0143] newHeading=(360+(heading+deltaHeading)%360)%360 (14)

[0144]

[0145] Step 2.2.2.2: According to the change in the camera position, perform ray collision detection on the new camera position value to determine whether the camera can reach the position. The process is different for flying and walking. Flying goes to step 2.2.2.2.1, and walking goes to step 2.2.2.2.2:

[0146] Step 2.2.2.2.1, in the flying roaming mode, according to the current camera position ccmeraPosition and the camera position change generated by the previous step Perform ray collision detection on the scene to determine whether the camera position change is feasible, such as Figure 5 If the displacement does not collide with the scene, the camera position will be updated as shown. Figure 5 As shown in Figure ①; if the displacement collides, the camera position remains unchanged, such as Figure 5 As shown in Figure ②, the flight roaming speed flySpeed ​​is assigned to flyBaseSpeed, and the Shift key is stopped to accelerate. The new camera position calculation is shown in the following formula:

[0147]

[0148] Step 2.2.2.2.2, in walking roaming mode,

[0149] (1) Based on the current camera position cameraPosition and the camera horizontal and vertical position changes generated by the previous steps and Perform ray collision detection on the scene (similar to step 2.2.2.2.1) to determine whether the position change is feasible like Figure 6 As shown in Figure ①, if it is feasible, continue with the subsequent steps; if it is not feasible, the camera position remains unchanged, exit the current step, and go directly to step 2.2.3;

[0150] (2) According to the changed camera position cameraPosition′, perform downward and upward ray collision detection to further ensure that the new camera position longitudinal space can accommodate the roaming personnel, such as Figure 6As shown in Figure ② in the figure. First, perform downward ray collision detection. The distance threshold downColliDis of the downward detection is set to the eye height value of the person's line of sight eyeHeight (if it exceeds this distance range, the scene objects will not hinder roaming, so no detection is required). Within the distance threshold, if the ray intersects with the ground, the intersection is recorded as groundP′ and the corresponding distance value is recorded as grounndDis, as shown in Figure 6 As shown in Figure ② in ; if there is no intersection, groundDis takes the maximum value Double.MAX_VALUE, such as Figure 7 As shown in Figure ②. Upward ray detection distance threshold

[0151] upColliDis=Max(personHeight-eyeHeight, personHeight-groundDis), which is used to ensure that the head does not collide with the top. If there is no intersection within the distance threshold in the upward collision detection, it means that the longitudinal space of the camera position cameraPosition′ can accommodate the roaming person, so the subsequent steps are entered; otherwise, it means that a collision occurs on the top of the head, and vSpeed ​​is assigned to 0, so that the person falls directly after jumping and hitting the head (see step 2.2.1.1.2 formula (5)), and exit the current step and directly enter step 2.2.3;

[0152] (3) If the longitudinal space can accommodate the roaming personnel, then according to cameraPosition′, it is detected whether there is a ground intersection point groundP′ and the intersection distance value groundDis, and the resulting camera position newCamerαPosition is further generated, such as Figure 6 Figure ③ and Figure 7 As shown in Figure ③, the schematic diagram of the resulting camera position when there is and does not exist a ground intersection. In this step, if there is a ground intersection, it means that the person has landed, then vSpeed ​​is assigned to 0, and onGround is assigned to true to stop gravity from accelerating the fall (see step 2.2.1.1.2 formula (5)); if there is no ground intersection, it means that the person is in mid-air, then onGround is assigned to false, so that the jump cannot be triggered. The camera position calculation is shown in the following formula:

[0153]

[0154] Step 2.2.3, according to the new camera posture (newHeading, newPitch) and camera position (newCameraPosition) generated in step 2.2.2, set the camera parameters to update the camera posture and position. Then return to step 2.2.1 to perform the next cycle of roaming process. Repeat this process continuously to continuously perform smooth and efficient first-person perspective flight and walking roaming. The flight roaming and walking roaming operation interfaces in this embodiment are as follows: Figure 8 as shown in .

[0155] Step 3, press the end command (performed by pressing the Esc key in this embodiment), turn off the mouse, keyboard and other event responses, turn off the roaming loop logic, and end the first-person perspective roaming process.

[0156] Conclusion: This embodiment adopts the method of the present invention to simulate realistic roaming physical effects such as collision, gravity, jumping, acceleration and deceleration in a Web-based three-dimensional scene including terrain, building structures, etc., and perform scene interactive first-person flight and walking roaming; and this embodiment adopts the collision detection logic used by the method of the present invention, and uses methods such as fast roaming collision judgment based on ray collision detection, while considering the authenticity of the roaming simulation, it also ensures the overall execution efficiency; it overcomes the defects of the prior art that it consumes considerable hardware resources due to factors such as collision detection, gravity drop, jumping, climbing, etc., which easily causes the rendering and visualization process to freeze, and in order to ensure operating efficiency, the first-person perspective roaming function is only performed in an environment with a small three-dimensional scene or a limited amount of spatial data, and there is no corresponding Web-based first-person roaming implementation that considers collision, gravity, jumping, acceleration and deceleration, etc., and realistic, real-time, and efficient first-person perspective roaming cannot be achieved.

[0157] The above is only an embodiment of the present invention and is not intended to limit the present invention. Any modification, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

[0158] Other parts not described belong to the prior art.

Claims

1. A first-person perspective roaming method for a Web terminal under massive spatial data, characterized by: The following steps are included: Step 1: Initialize the first-person perspective roaming settings; Step 2: Perform first-person perspective roaming, start monitoring roaming operations and dynamically update the camera posture and position in a loop; Step 3: Press the end command to turn off the mouse and keyboard event responses, turn off the roaming loop logic, and end the first-person perspective roaming process; In step 1, the first-person perspective roaming initialization settings are performed, including roaming parameter settings and interactive operation item settings; It includes the following sub-steps: Step 1.1, perform roaming parameter initialization settings, including general roaming parameter settings and special parameter settings for two different modes, walking and flying, respectively; Step 1.2, initializing the interactive operation items, including initializing the mouse and keyboard operation items, to specify the specific keys for interactive operations during roaming; In step 1, the general roaming parameters are set to include the maximum and minimum pitch angles maxPitch and minPitch, the collision detection distance tolerance collisionToler, and the mouse operation sensitivity poseSens; The flight roaming parameter settings include the flight displacement base speed flyBaseSpeed, the flight displacement acceleration flyAcceler and the flight displacement maximum speed flyMaxSpeed; Walking roaming parameter settings include person height personHeight, person sight height eyeHeight, walking horizontal displacement base speed walkBaseSpeed, walking horizontal displacement acceleration walkAcceler, walking horizontal displacement maximum speed walkMaxSpeed, gravity vertical displacement acceleration gravityAcceler and jumping vertical displacement initial speed jumpSpeed; In step 1, the specific mouse operation items in the specific keys for interactive operations during roaming are: horizontal and vertical sliding of the mouse controls the azimuth and pitch angle of the line of sight; the keyboard operation items are: pressing the W key, S key, A key and D key to control the viewpoint to move forward, backward, left and right, the Shift key to accelerate, the Q key and E key to lower or raise the viewpoint height, the T key to turn on or off collision detection, the Space key to jump in walking mode, and the F key to switch between flying and walking roaming modes; In step 2, roaming is performed from the first-person perspective, and the operation monitoring of the roaming mouse and keyboard is turned on to start monitoring the roaming operation and dynamically update the camera posture and position in a loop; the subsequent roaming process of dynamic changes in the camera posture and position is performed in a loop; It includes the following sub-steps: Step 2.1, start the roaming mouse and keyboard operation monitoring, record all mouse and keyboard roaming operation status, including the following sub-steps: Step 2.1.1, the browser enters PointerLock mode, the mouse cursor disappears, and the mouse can slide infinitely without being affected by the screen range; then the mouse sliding event monitoring is turned on, and when the mouse slides, the mouse sliding transformation movement is obtained, where the horizontal displacement of the mouse is movement.movementX, and the vertical displacement is movement.movementY; Step 2.1.2, enable keyboard press and release event monitoring. When the W, S, A, D, Q, E, Shift keys are pressed or released, the variables wPress, sPress, aPress, dPress, qPress, ePress, and shiftPress are set to 1 or 0 synchronously. After pressing T, the variable collisionTest = !collisionTest is used to switch whether collision detection is performed during roaming. After pressing Space, if the current mode is walking and the person is on the ground, jump. After pressing F, the variable walkMode = !walkMode is used to switch between walking roaming and flying roaming modes. Step 2.2, after the roaming operation monitoring is turned on, the subsequent roaming process is continuously looped, and the loop is performed in each rendering frame, or according to the fixed interval deltaTime; in each post-roaming loop, the mouse and keyboard operations are detected once, and the camera is updated accordingly. This process is continuously looped to achieve smooth 3D scene roaming; The method of achieving smooth 3D scene roaming specifically includes the following sub-steps: Step 2.2.1, at the beginning of each roaming cycle, the roaming speed value is updated according to the roaming operation, and the camera changes caused by the mouse, keyboard operation and gravity acceleration are generated; the camera changes caused are specifically divided into: camera posture changes caused by mouse sliding, camera position changes caused by keyboard operation and gravity acceleration; Step 2.2.2, judging the camera attitude change and position change generated in the previous step of step 2.2.1, and generating new camera attitude value and camera position value accordingly; Step 2.2.3, according to the new camera posture and camera position generated in step 2.2.2, set the camera parameters to update the camera posture and position; then return to step 2.2.1 to perform the next cycle of roaming process; Repeat steps 2.2.1 to 2.2.3 continuously to achieve smooth and efficient first-person perspective flight and walking roaming; In step 2.2.1, the camera variation caused is generated, including the following sub-steps: Step 2.2.1.1: In this roaming cycle, dynamically update the roaming speed parameters according to the keyboard Shift and Space operation key status and gravity acceleration; if it is flying roaming mode, go to step 2.2.1.1.1; if it is walking roaming mode, go to step 2.2.1.1.2: Step 2.2.1.1.1, update the flight roaming displacement speed, realize the Shift key progressive acceleration, the roaming speed update calculation formula is shown in the following formula (1) and formula (2); where flyAcceler is the flight roaming acceleration; deltaTime is the cycle interval time; flySpeed ​​is the flight roaming basic displacement speed; flySpeed ​​is the flight roaming maximum speed; flySpeed ​​is the flight roaming displacement speed: Step 2.2.1.1.2, update the horizontal displacement speed of walking roaming to realize the gradual acceleration of the Shift key; update the vertical displacement speed of walking roaming to realize gravity falling and jumping; the specific calculation formula of the horizontal displacement speed of walking is shown in the following formula (3) and formula (4); where walkAcceler is the walking roaming acceleration; deltaTime is the cycle interval time; walkBaseSpeed ​​is the basic displacement speed of walking roaming; walkMaxSpeed ​​is the maximum speed of walking roaming; hSpeed ​​is the horizontal displacement speed of walking roaming: The calculation formula of walking vertical displacement speed is shown in the following formula (5); where vSpeed ​​is the walking vertical displacement speed. When colliding with the ground or the top surface, it is directly assigned to 0; when on the ground and the Space button is pressed, it is assigned to the initial jump speed jumpSpeed; in other cases, gravity acceleration calculation is performed, gravityAcceler is the gravity acceleration; deltaTime is the loop interval time: Step 2.2.1.2, according to the displacement value generated by the mouse sliding event, calculate the posture change that the camera should produce; among which, the horizontal displacement of the mouse movementX is converted into the camera azimuth angle change deltaHeading; the vertical displacement movementY is converted into the camera pitch angle change deltaPitch; the calculation formula is shown in the following formula (6) and formula (7): Where: screenWidth and screenHeight are the width and height of the 3D scene screen respectively, poseSens is the camera posture change sensitivity set in the previous step, deltaHeading and deltaPitch are the camera azimuth and pitch angle change results; Step 2.2.1.3, calculate the position change that the camera should generate based on the keyboard pressing and releasing W, S, A, D, Q, E events; the calculation of the position change is different for the two different modes of flying and walking. If it is flying, go to step 2.2.1.3.1; if it is walking, go to step 2.2.1.3.2: Step 2.2.1.3.1, calculate the camera position change in the flight roaming mode, the calculation formula is shown in the following formula (8) and formula (9): step=flySpeed×deltaTime (9) In the formula, They are the forward, right, and upward direction vectors of the roaming camera, which are directly obtained according to the current camera posture of the scene; wPress, sPress, wPress, aPress, ePress, and qPress are the record variables of whether each roaming operation button is pressed in the previous step, and the value is 0 or 1; normalize() is the vector normalization processing; step is the step value of the camera displacement; flySpeed ​​is the flight roaming displacement speed; deltaTime is the loop interval time; Then is the calculated camera displacement result vector; Step 2.2.1.3.2, calculate the camera position change in walking roaming mode. The walking position change is composed of the horizontal displacement caused by keyboard manipulation and the vertical displacement caused by gravity acceleration. The horizontal displacement calculation formula is shown in the following equations (10) and (11): hStep=hSpeed×deltaTime (11) Where, hStep is the horizontal displacement step length; hSpeed ​​is the horizontal displacement speed of walking roaming; is the horizontal displacement result vector; The vertical displacement calculation formula is shown in the following formula (12), where vSpeed ​​is the vertical displacement speed of walking roaming; deltaTime is the cycle interval time; is the result vector of vertical displacement; The camera displacement vector after integrating the horizontal displacement value and the vertical displacement value is calculated as shown in the following formula (13), where That is the camera displacement result vector; In step 2.2.2, new camera attitude values ​​and camera position values ​​are generated, which specifically includes the following sub-steps: Step 2.2.2.1, calculate and judge the new camera attitude value according to the camera attitude change deltaHeading and deltaPitch, so that after adding the transformation, the camera attitude parameters are within the valid range of newHeading value range [0,360) and newPitch value range [minPitch, maxPitch]. The calculation formula is shown in the following formula (14) and formula (15): newHeading=(360+(heading+deltaHeading)%360)%360 (14) Step 2.2.2.2: Perform ray collision detection on the new camera position value according to the camera position change to determine whether the camera can reach the position. The process is different for flying and walking. The flying process goes to step 2.2.2.2.1, and the walking process goes to step 2.2.2.2.2: Step 2.2.2.2.1, in the flying roaming mode, according to the current camera position cameraPosition and the camera position change generated by the previous step Perform ray collision detection on the scene to determine whether the camera position change is feasible; if the displacement does not collide with the scene, the camera position will be updated; if the displacement collides, the camera position remains unchanged, and the flight roaming speed flySpeed ​​is assigned to flyBaseSpeed, and the Shift key is stopped to accelerate; the new camera position is calculated as shown in the following formula (16): Step 2.2.2.2.2, in walking roaming mode, Step 2.2.2.2.2.1, based on the current camera position cameraPosition and the camera horizontal and vertical position changes generated by the previous steps and Perform ray collision detection on the scene to determine whether the position change is feasible; if feasible, continue with the subsequent steps; if not feasible, the camera position remains unchanged, exit the current step, and directly enter step 2.2.3; Step 2.2.2.2.2.2, according to the changed camera position cameraPosition′, perform downward and upward ray collision detection to further ensure that the new camera position longitudinal space can accommodate the roaming personnel; first perform downward ray collision detection, and set the distance threshold downColliDis of the downward detection to the personnel's line of sight height value eyeHeight; within the distance threshold, if the ray intersects with the ground, the intersection is recorded as groundP′ and the corresponding distance value is recorded as groundDis; if there is no intersection, groundDis takes the maximum value Double.MAX_VALUE; The upward ray detection distance threshold upColliDis = Max(personHeight-eyeHeight, personHeight-groundDis) is used to ensure that the head does not collide with the top; if there is no intersection within the distance threshold for the upward collision detection, it means that the longitudinal space of the changed camera position cameraPosition′ can accommodate the roaming person, so proceed to the subsequent steps; otherwise, it means that a collision occurs on the top of the head, and vSpeed ​​is assigned to 0, so that the person falls directly after jumping and hitting the head, and exits the current step and directly enters step 2.2.3; Step 2.2.2.2.2.3, if the longitudinal space can accommodate the roaming personnel, then according to the changed camera position comeraPosition′, check downward whether there is a ground intersection groundP′ and the intersection distance value groundDis, and further generate the result camera position newCameraPosition; and in this step, if there is a ground intersection, it means that the person has landed, then vSpeed ​​is assigned to 0, and onGround is assigned to true to stop gravity accelerating the fall; if there is no ground intersection, it means that the person is in mid-air, then onGround is assigned to false, so that the jump cannot be triggered; the camera position calculation is shown in the following formula (17):