Search

CN-115270018-B - Model rotation control method, device, equipment and storage medium

CN115270018BCN 115270018 BCN115270018 BCN 115270018BCN-115270018-B

Abstract

The invention discloses a method, a device, equipment and a storage medium for controlling rotation with damping for a model, wherein the method comprises the steps of acquiring a rotation end event and responding to the rotation end event to calculate a rotation angle change value along with each preset time interval within a preset time range; and controlling the model to be rotated to stop rotating in a mode with nonlinear damping within the preset time range according to the rotation angle change value. The damping rotation control and real-time synchronization effects of the BIM model loaded by the Unity engine are achieved by utilizing a damping algorithm and combining a full duplex communication technology.

Inventors

  • You Yongmin
  • Request for anonymity

Assignees

  • 久瓴(江苏)数字智能科技有限公司

Dates

Publication Date
20260505
Application Date
20210429

Claims (9)

  1. 1. A model rotation control method, characterized in that the method comprises: acquiring a rotation ending event, wherein the rotation ending event comprises a gesture event sent by a browser, and the gesture event is an event for converting a pressing gesture into a lifting gesture; calculating a rotation angle change value along with each preset time interval within a preset time range in response to the rotation ending event, wherein the time of the lifting gesture is determined as initial time, an initial angle is calculated according to the initial time, and a rotation angle damping calculation formula is adopted Calculating a rotation angle corresponding to the rendering time of each frame after the initial time, obtaining a rotation angle change value of each time by calculating a difference value between the rotation angle and the initial angle, wherein a and b are calibration values obtained according to a simulation experiment, xn is the rendering time of each frame, yn is the rotation angle, and And controlling the building information model to be finished rotating to stop rotating in a nonlinear damping mode within the preset time range according to the rotation angle change value.
  2. 2. The model rotation control method according to claim 1, characterized in that the method further comprises: And sending the rotation angle change value to a display engine of the building information model to be finished in rotation through a preset two-way communication protocol so as to drive the building information model to be finished in rotation to stop rotating in a nonlinear damping mode.
  3. 3. The model rotation control method of claim 2, wherein the preset bidirectional communication protocol is WebSocket protocol.
  4. 4. The method of claim 1, wherein calculating the change in the rotation angle with each preset time interval within the predetermined time range further comprises acquiring a coordinate position of the movement gesture according to a previous operation behavior of the user, and determining the rotation direction by lifting the coordinate position of the gesture and the coordinate position of the movement gesture.
  5. 5. The method of model rotation control according to claim 1, wherein calculating the rotation angle variation value with each preset time interval within the predetermined time range further comprises calculating the rotation angle variation value within 2 seconds.
  6. 6. The model rotation control method according to claim 4, wherein calculating a rotation angle variation value with each preset time interval in a predetermined time range further comprises: And calculating each rotation angle change value in the preset time range according to the initial angle, the rotation angle corresponding to the rendering time of each frame and the rotation direction, wherein the difference value between the rendering time of each frame and the initial time is smaller than or equal to the preset time.
  7. 7. A model rotation control device, characterized in that the device comprises: The acquisition module is used for acquiring a rotation ending event, wherein the rotation ending event comprises a gesture event sent by a browser, and the gesture event is an event for converting a pressing gesture into a lifting gesture; A calculation module for calculating a rotation angle variation value along with each preset time interval within a preset time range in response to the rotation end event, wherein the time of the lifting gesture is determined as an initial time, an initial angle is calculated according to the initial time, and a rotation angle damping calculation formula is used for calculating the initial angle Calculating a rotation angle corresponding to the rendering time of each frame after the initial time, obtaining a rotation angle change value of each time by calculating a difference value between the rotation angle and the initial angle, wherein a and b are calibration values obtained according to a simulation experiment, xn is the rendering time of each frame, yn is the rotation angle, and And the control module is used for controlling the building information model to be rotated to stop rotating in a nonlinear damping mode within the preset time range according to the rotation angle change value.
  8. 8. A computer device comprising a memory, a processor, the memory having stored thereon a computer program executable on the processor, characterized in that the processor, when executing the computer program, implements the steps of the method according to any of claims 1 to 6.
  9. 9. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, realizes the steps in the model rotation control method according to any one of claims 1 to 6.

Description

Model rotation control method, device, equipment and storage medium Technical Field The present invention relates to the field of model control, and in particular, to a method, apparatus, device, and storage medium for controlling model rotation. Background Building Information Model (BIM) is a new tool for architecture, engineering and civil engineering to represent three-dimensional graphics-based, object-oriented, architecture-related computer-aided design. BIM technology plays an important role in improving production efficiency, saving cost and shortening construction period through the data and information model integration of the building. The method has the five characteristics of visualization, coordination, simulation, optimality and diagrammability. Unity, also called Unity 3D, is a multi-platform comprehensive game development tool developed by Unity Technologies to allow players to easily create interactive content of various types, such as three-dimensional video games, building visualizations, real-time three-dimensional animations, etc., and is a comprehensive and integrated professional game engine comprising graphic, sound, physical, etc. functions. The Unity itself can respond to the common rotation of linear interpolation between two points, and can realize a common rotation controller by combining the two-point coordinate information transmitted by the web front end. However, when the requirement of combining Unity rotation at the web front end becomes more and the effect requirement is more realistic, the general response manner for rotation has not been able to meet the actual requirement. The conventional scheme of implementing the above-mentioned general rotation controller by combining, for example, unity with the web front end has the following problems, though the scheme has a wide range: 1. The conventional Unity linear interpolation controller cannot satisfy all scenes required by the web controller. 2. When the web controller is operated frequently, the BIM model loaded by the Unity engine may have a display effect of repeated lateral jumps. 3. The Web and the Unity two ends cannot achieve complete synchronization of rotation control, and only can send messages to the Unity engine through the Web unilateral. Disclosure of Invention Aiming at the defects in the prior art, the invention provides a method, a device, equipment and a storage medium for controlling the rotation of a model, which utilize a damping algorithm to combine with a websocket (full duplex communication) technology to realize the effects of damping rotation control and real-time synchronization of a Unity loaded BIM model. To achieve the above object, an embodiment of the present invention provides a model rotation control method including acquiring a rotation end event and calculating a rotation angle variation value with each preset time interval within a predetermined time range in response to the rotation end event, and controlling a model to be rotated to stop rotating with nonlinear damping within the predetermined time range according to the rotation angle variation value. The method further comprises the step of sending the rotation angle change value to a display engine of the model to be finished in rotation through a preset two-way communication protocol so as to drive the model to be finished in rotation to stop rotating in a mode with nonlinear damping. The preset bidirectional communication protocol is WebSocket protocol. The method further includes the step of acquiring a rotation ending event, wherein the gesture event is an event of converting a pressing gesture into a lifting gesture, and the gesture event is sent by a browser. Calculating the rotation angle variation value along with each preset time interval in the preset time range further comprises the steps of acquiring the coordinate position of the movement gesture according to the previous operation behavior of the user, and determining the rotation direction through the coordinate position of the lifting gesture and the coordinate position of the movement gesture. Calculating the rotation angle variation value with each preset time interval within the predetermined time range further includes calculating the rotation angle variation value within 2 seconds. Calculating a rotation angle change value of each preset time interval within a preset time range further comprises determining the time of the lifting gesture as an initial time, calculating an initial angle according to the initial time, calculating a rotation angle corresponding to the rendering time of each frame according to the rendering time of the frame after the initial time, wherein the difference value between the rendering time of each frame and the initial time is smaller than or equal to the preset time, and calculating each rotation angle change value within the preset time range according to the initial angle, the rotation angle corresponding to the rendering time