Motion control method, device and electronic equipment
By using multiple control points to generate initial and updated curve trajectories in the motion control method of virtual moving objects, the problem of insufficient trajectory smoothness and flexibility is solved, and the smooth transition when the target position is changed is achieved, which improves visual fluency and gaming experience.
Patent Information
- Application Number
- CN202510024041.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-01-07
AI Technical Summary
When the target position of the virtual moving object is frequently changed, the existing motion control methods lack trajectory smoothness and flexibility, making it difficult to achieve smooth transitions, affecting visual fluency and gaming experience.
By obtaining multiple control points of the virtual moving object, the initial curve track is generated, and when the end point changes, it is determined that the target control point is located on the tangent of the current position point, and an update curve track is generated to ensure a smooth transition.
It realizes a smooth transition of virtual moving objects when the target position changes, improves visual fluency and game interactivity, and enhances the adaptability and instant response capabilities of dynamic trajectories.
Smart Images

Figure CN119770975B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a motion control method, apparatus, device, storage medium, and program product. Background Art
[0002] At present, some simple motion control methods have been widely used in games (for example, elimination games) to achieve dynamic movement of virtual moving objects. However, most of the related technologies are based on fixed trajectory patterns and lack the flexibility of trajectory adjustment. For example, linear interpolation, fixed paths, polynomial interpolation and traditional Bezier curves are not adaptable enough to complex trajectory changes. Moreover, when the target position of the virtual moving object changes frequently, it is difficult for the related technologies to achieve a smooth transition of the trajectory, that is, the trajectory is not smooth enough when the target position changes, and it is easy to have abrupt direction problems in multiple target position changes, affecting visual fluency. Summary of the Invention
[0003] Embodiments of the present application provide a motion control method, apparatus, device, storage medium, and program product, which can achieve a smooth transition of the curved trajectory of a virtual motion object when the end point changes.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] An embodiment of the present application provides a motion control method, which includes: obtaining multiple control points of a virtual motion object; generating an initial curve trajectory of the virtual motion object based on the multiple control points; in response to a change in an end point among the multiple control points when controlling the virtual motion object to move along the initial curve trajectory, obtaining a current position point, an updated end point, and a target control point of the virtual motion object; the target control point is located on a tangent of the initial curve trajectory at the current position point; generating an updated curve trajectory of the virtual motion object based on the current position point, the updated end point, and the target control point; and controlling the virtual motion object to move along the updated curve trajectory starting from the current position point.
[0006] An embodiment of the present application provides a motion control device, including: a first acquisition module, used to acquire multiple control points of a virtual motion object; a first generation module, used to generate an initial curve trajectory of the virtual motion object based on the multiple control points; a second acquisition module, used to acquire the current position point, updated end point and target control point of the virtual motion object in response to a change in the end point of the multiple control points when controlling the virtual motion object to move along the initial curve trajectory; the target control point is located on the tangent of the initial curve trajectory at the current position point; the second generation module, used to generate an updated curve trajectory of the virtual motion object based on the current position point, the updated end point and the target control point; and a control module, used to control the virtual motion object to move along the updated curve trajectory starting from the current position point.
[0007] In the above scheme, the multiple control points include at least: a first control point, a second control point and a third control point; the third control point is the termination point; the first generation module is also used to: on the first line between the first control point and the second control point, according to preset parameters, determine multiple first continuous points moving from the first control point to the second control point; on the second line between the second control point and the third control point, according to preset parameters, determine multiple second continuous points moving from the second control point to the third control point; wherein, each first continuous point corresponds to a second continuous point; for each first continuous point, on the third line between the first continuous point and the corresponding second continuous point, according to preset parameters, determine a third continuous point moving from the first continuous point to the second continuous point, to obtain multiple third continuous points; and sequentially connect the first control point, the multiple third continuous points and the third control point to obtain the initial curve trajectory.
[0008] In the above scheme, the second acquisition module is also used to: acquire the target first continuous point and the target second continuous point corresponding to the current position point; the fourth line between the target first continuous point and the target second continuous point overlaps with the tangent of the initial curve trajectory at the current position point; determine the distance value between the target second continuous point and the third control point; in response to the distance value being greater than a preset distance threshold, determine the target second continuous point as the target control point; in response to the distance value being less than or equal to the preset distance threshold, determine the target control point on the extension line of the fourth line; the direction of the extension line is from the target first continuous point to the target second continuous point.
[0009] In the above scheme, the second generation module is further used to: determine, on the fifth line between the current position point and the target control point, a plurality of fourth continuous points moving from the current position point to the target control point according to the preset parameters; determine, on the sixth line between the target control point and the updated end point, a plurality of fifth continuous points moving from the target control point to the updated end point according to the preset parameters; wherein each fourth continuous point corresponds to a fifth continuous point; for each fourth continuous point, determine, on the seventh line between the fourth continuous point and the corresponding fifth continuous point, a sixth continuous point moving from the fourth continuous point to the fifth continuous point according to the preset parameters, to obtain a plurality of sixth continuous points; and sequentially connect the current position point, the plurality of sixth continuous points and the updated end point to obtain the updated curve trajectory.
[0010] In the above scheme, the second acquisition module is also used to: in response to controlling the virtual motion object to move along the initial curved trajectory, obtain the movement speed of the tracking object of the virtual motion object; based on the movement speed, determine the time interval for updating the curved trajectory of the virtual motion object; every time interval, obtain the current position point of the virtual motion object, the tracking position point where the tracking object is currently located, and the target control point; wherein, the tracking position point is the updated end point.
[0011] In the above scheme, the first acquisition module is also used to: in response to receiving a tracking operation for a tracking object, obtain the starting point of the virtual motion object and the tracking position point where the tracking object is currently located; based on a preset curve trajectory curvature coefficient, obtain multiple candidate control points; based on the starting point of the virtual motion object, the tracking position point and the environmental parameters of the virtual environment where the virtual motion object is located, determine multiple intermediate control points from the multiple candidate control points; and determine the starting point of the virtual motion object, the multiple intermediate control points and the tracking position point as the multiple control points.
[0012] In the above scheme, the second acquisition module is also used to: in response to controlling the virtual moving object to move along the initial curve trajectory, the current tracking object corresponding to the initial curve trajectory disappears, and a new tracking object is determined; and the current position point of the new tracking object is determined as the updated end point.
[0013] In the above scheme, the device also includes a stopping module, which is used to: in response to controlling the virtual moving object to move along the initial curved trajectory, the current tracking object corresponding to the initial curved trajectory disappears, and stop the movement of the virtual moving object along the initial curved trajectory.
[0014] An embodiment of the present application provides an electronic device, comprising: a memory for storing computer-executable instructions; and a processor for implementing the motion control method provided in the embodiment of the present application when executing the computer-executable instructions stored in the memory.
[0015] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing the motion control method provided in the embodiment of the present application when executed by a processor.
[0016] An embodiment of the present application provides a computer program product, which includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; wherein, when a processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, the motion control method provided in the embodiment of the present application is implemented.
[0017] The embodiments of the present application have the following beneficial effects:
[0018] After generating an initial curve trajectory of the virtual motion object based on multiple control points of the virtual motion object, the virtual motion object is controlled to move along the initial curve trajectory. During the process of the virtual motion object moving along the initial curve trajectory, if the end point of the multiple control points changes, the virtual object cannot continue to move along the initial curve trajectory. At this time, a target control point is determined on the tangent of the initial curve trajectory at the current position point, and the current position point and the updated end point of the virtual motion object are determined. Finally, based on the current position point, the updated end point and the target control point, an updated curve trajectory of the virtual motion object is generated, and the virtual motion object is controlled to move along the updated curve trajectory starting from the current position point. In this way, the virtual motion object can respond to changes in the end point in a timely manner during the process of moving along the initial curve trajectory, and regenerate an updated curve trajectory that meets the requirements based on the updated end point and the target control point, thereby ensuring a smooth transition between the updated curve trajectory and the initial curve trajectory and ensuring the continuity of the curve trajectory of the virtual motion object. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a schematic diagram of the structure of the motion control system provided by an embodiment of the present application;
[0020] Figure 2 is a schematic structural diagram of a motion control device provided in an embodiment of the present application;
[0021] Figure 3 This is an optional flowchart of the motion control method provided in the embodiment of the present application;
[0022] Figure 4is another optional flow chart of the motion control method provided in an embodiment of the present application;
[0023] Figure 5 This is a schematic diagram of an implementation flow of obtaining multiple control points of a virtual moving object provided by an embodiment of the present application;
[0024] Figure 6 1 is a schematic diagram of an implementation process for generating an initial curved trajectory of a virtual moving object provided by an embodiment of the present application;
[0025] Figure 7 This is a schematic diagram of an implementation flow of obtaining the current position point, updated end point, and target control point of the virtual moving object provided by an embodiment of the present application;
[0026] Figure 8 This is a schematic diagram of the implementation process of obtaining the target control point of a virtual moving object provided by an embodiment of the present application;
[0027] Figure 9 1 is a schematic diagram of an implementation flow of generating an update curve trajectory of a virtual motion object provided by an embodiment of the present application;
[0028] Figure 10 is a schematic diagram of a first-order Bezier curve provided in an embodiment of the present application;
[0029] Figure 11 is a schematic diagram of a second-order Bezier curve provided in an embodiment of the present application;
[0030] Figure 12 This is an updated schematic diagram of the second-order Bezier curve provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0032] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0033] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0034] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0035] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0036] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0037] Some simple motion control methods in related technologies have been widely used in games to achieve dynamic movement of flying objects. Common technical solutions include: 1) Linear interpolation: Some puzzle games use a linear interpolation algorithm to adjust the trajectory of flying objects. This method generates a straight line between the current position of the flying object and the target position, and moves smoothly along this line. It is computationally simple and suitable for scenarios that require fast path generation. 2) Fixed-path trajectory planning: Many puzzle games specify a fixed path during the initial setting of the flying object, such as a straight line, circular arc, or parabola. The flying object moves along this path, which is simple to calculate and suitable for relatively simple flight trajectory scenarios. 3) Dynamic path generation using a combination of parabolas and polylines: Some puzzle games use a combination of parabolas or polylines to generate flight paths to meet specific dynamic movement requirements. This method provides a relatively flexible combination of flight path shapes and is suitable for adjusting the flying object's path within a certain range. 4) Polynomial interpolation: Some puzzle games use polynomial interpolation to generate flight paths. By setting multiple control points, the polynomial interpolation method can generate a smooth curve, which is suitable for dynamic path generation and can maintain the continuity of the trajectory to a certain extent. 5) Bezier curve method: Bezier curves are widely used in games to generate dynamic flight trajectories, and are particularly suitable for the generation of soft curves. By setting control points, Bezier curves can generate a variety of smooth trajectories, which are suitable for the control of flying object trajectories with complex paths. In common elimination games, when the target position of a flying object changes, the flying object will often continue to fly towards the initial target position, and after arriving, it will generate a new trajectory curve and continue to fly towards the new target. This setting is widely used in current trajectory generation, ensuring the continuity of the flight path and the ease of implementation.
[0038] However, the motion control methods in related technologies have the following major shortcomings in terms of dynamic target adaptability and smooth trajectory transitions: 1) Insufficient trajectory smoothness. When the target of the flying object switches, the trajectory smoothness is insufficient. When using methods such as linear interpolation, fixed path solutions, parabolic combinations, or polynomial interpolation, the movement of the flying object during target switching appears unnatural and is prone to sudden changes in direction, which reduces the visual effect and gaming experience. 2) Insufficient flexibility. Most related technologies are based on fixed trajectory modes and lack the flexibility of trajectory adjustment. Linear interpolation, fixed paths, polynomial interpolation, and traditional Bezier curves have insufficient adaptability to complex trajectory changes, which limits the flexibility of dynamic adjustment of flying objects and cannot meet the needs of multi-target switching. 3) Poor adaptability to dynamic targets. When the target position of the flying object changes frequently, related technologies have difficulty in achieving smooth switching. Most solutions have insufficiently smooth trajectories during target switching, which easily leads to abrupt direction changes during multiple target changes, affecting visual fluency. 4) Mid-course switching is not instantaneous. In elimination games using Bezier curves, flying objects typically reach their original target before turning to a new one, preventing the flexibility of mid-flight target switching (which is crucial for tracking objects). This processing method can be sluggish in complex dynamic scenes and lacks smooth real-time response.
[0039] To address at least one of the issues mentioned above, the present invention proposes a method for intelligently smoothing the trajectory of an arbitrary multi-point flying object based on curve fitting. This method offers the following technical improvements: 1) Highly smooth trajectory generation: This method uses Bezier curves to generate flight trajectories. By adjusting the curve's control points, the tangent direction of the trajectory remains consistent when switching targets, avoiding sudden changes in direction and improving visual smoothness and experience. 2) Flexible multi-point trajectory adjustment: This method supports dynamic trajectory adjustment of arbitrary multi-points, allowing the flying object to flexibly regenerate its trajectory based on target changes. The intelligent smoothing system automatically calculates the Bezier curve based on the new target position, ensuring trajectory continuity and natural flow during multi-point switching. 3) Enhanced dynamic adaptability: The intelligent smoothing system can respond to changes in the flying object's target position in real time, promptly regenerating a Bezier curve trajectory that meets the requirements based on the new position, ensuring smooth transitions during frequent target changes. 4) Instant mid-flight switching: This method allows the flying object to instantly respond to target changes during flight without requiring the flying object to first reach the original target position. The system can instantly regenerate a smooth curve that matches the new target, transitioning smoothly with the original trajectory. This allows for flexible mid-course switching and improves the responsiveness and fluidity of dynamic trajectories. This method makes object trajectory generation more intelligent, flexible, and smooth, effectively resolving the issues of poor adaptability, abrupt switching, unresponsiveness, and high latency in related technologies. This provides users with a smoother visual experience and greater gaming interactivity.
[0040] The following describes exemplary applications of the motion control device (i.e., electronic device) provided in the embodiments of the present application. The motion control device provided in the embodiments of the present application can be implemented as various types of user terminals capable of motion control, such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals. It can also be implemented as a server. The following describes exemplary applications when the motion control device is implemented as a server.
[0041] See also Figure 1 , Figure 1 It is a structural diagram of the motion control system 100 architecture provided in an embodiment of the present application. In order to support a motion control application, the terminal 400 is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0042] The terminal 400 is used to send a motion control request to the server 200. The server 200 constitutes the motion control device of the embodiment of the present application. The server 200 is used to obtain multiple control points of a virtual motion object in response to the motion control request; generate an initial curve trajectory of the virtual motion object based on the multiple control points; in response to the end point of the multiple control points changing when controlling the virtual motion object to move along the initial curve trajectory, obtain the current position point, updated end point, and target control point of the virtual motion object; the target control point is located on the tangent of the initial curve trajectory at the current position point; generate an updated curve trajectory of the virtual motion object based on the current position point, the updated end point, and the target control point; control the virtual motion object to move along the updated curve trajectory starting from the current position point to obtain a motion control result. The motion control result is then returned to the terminal 400 so that the motion control result can be output at the terminal 400 or subsequent business processing can be performed based on the motion control result.
[0043] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal 400 can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, car terminal, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0044] See also Figure 2 , Figure 2 is a structural diagram of an electronic device 40 provided in an embodiment of the present application, Figure 2 The electronic device 40 shown may be a motion control device, which includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the motion control device are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .
[0045] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0046] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0047] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0048] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0049] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0050] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0051] A network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB); a presentation module 453 is used to enable presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with the user interface 430 (e.g., a display screen, a speaker, etc.); an input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.
[0052] In some embodiments, the apparatus provided in the embodiments of the present application may be implemented in software. Figure 2 A motion control device 455 stored in memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a first acquisition module 4551, a first generation module 4552, a second acquisition module 4553, a second generation module 4554, and a control module 4555. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0053] In some further embodiments, the apparatus provided in the embodiments of the present application may be implemented in hardware. As an example, the apparatus provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the motion control method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0054] In some embodiments, the terminal or server can implement the motion control method provided by the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (Application, APP), that is, a program that needs to be installed in the operating system to run, or it can be a small program that can be embedded in any APP, that is, a program that only needs to be downloaded to a browser environment and can be run. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.
[0055] The motion control methods provided in each embodiment of the present application can be executed by an electronic device, wherein the electronic device can be a server or a terminal, that is, the motion control methods provided in each embodiment of the present application can be executed by a server, or by a terminal, or by interaction between a server and a terminal.
[0056] See also Figure 3 , Figure 3 This is an optional flow chart of the motion control method provided in the embodiment of the present application, which will be combined with Figure 3 The steps shown are described below, and the execution subject of the motion control method is a server as an example. The method includes the following steps S101 to S105:
[0057] Step S101: Acquire multiple control points of a virtual moving object.
[0058] In the embodiment of the present application, a virtual motion object refers to an object that simulates motion in a virtual environment (e.g., computer simulation, animation, or video game). For example, the virtual motion object can be a car, a character, or an aircraft in the virtual environment. The position and motion of the virtual motion object in the virtual environment are all achieved through programming. A control point is a point that defines the motion curve or path shape of the virtual motion object. In a Bezier curve, the control point determines the starting point, the end point, and the curvature of the curve. That is, a plurality of control points include a starting point, an end point, and other control points for controlling the curvature of the curve. By moving a plurality of control points, the shape of the curve can be changed.
[0059] In some embodiments, the server may receive multiple control points set by a user via a virtual environment editor. Specifically, the multiple control points of a virtual moving object may be pre-set by the user based on actual virtual environment requirements. In other embodiments, the server may also determine other control points for controlling the curvature of the curve based on a preset mathematical model or optimization algorithm when determining the starting and ending points of the multiple control points of the virtual moving object, thereby obtaining the multiple control points of the virtual moving object.
[0060] Step S102: generating an initial curved trajectory of the virtual moving object based on multiple control points.
[0061] In the embodiment of the present application, the initial curve trajectory is a path generated based on the above-mentioned multiple control points, and the initial curve trajectory is used to describe the expected motion path of the virtual moving object in the virtual environment. The initial curve trajectory can be composed of a series of Bezier curves calculated by the control points.
[0062] In some embodiments, a starting point, other control points for controlling the curvature of the curve, and an ending point are first determined from among a plurality of control points. Then, based on these points, a preset curve generation method is used to generate a smooth curve trajectory, thereby obtaining the initial curve trajectory of the virtual moving object. The preset curve generation method can be a Bezier curve generation method, and the initial curve trajectory can be an Nth-order Bezier curve, where N is any integer greater than 1. The specific process for generating the initial curve trajectory is described below.
[0063] Step S103 , in response to a change in an end point among the multiple control points when the virtual moving object is controlled to move along the initial curve trajectory, the current position point, the updated end point and the target control point of the virtual moving object are obtained.
[0064] In an embodiment of the present application, the current position point of the virtual moving object refers to the specific coordinate position occupied by the virtual moving object in the virtual environment at the current moment. The current position point can be described by a set of coordinate values, which correspond to the reference coordinate system in the virtual environment. When the end point among multiple control points changes, the updated end point is the final position that the virtual moving object needs to reach after the change. When generating an updated curve trajectory, the target control point refers to one or more key points used to define the shape of the curve. The target control point is located on the tangent of the initial curve trajectory at the current position point.
[0065] In some embodiments, the real-time position of the virtual moving object can be obtained by a sensor or other position detection technology, that is, the current position point of the virtual moving object is obtained. The updated end point can be determined by user input, automatically detected environmental changes, or other system instructions. The target control point can be calculated according to a preset target control point determination rule, or the target control point can also be determined based on preset parameters and environmental conditions. For the specific process of obtaining the current position point, updated end point, and target control point of the virtual moving object, please refer to the following.
[0066] Step S104 : generating an updated curve trajectory of the virtual moving object based on the current position point, the updated end point and the target control point.
[0067] In an embodiment of the present application, the updated curve trajectory refers to an updated curve trajectory generated based on the current position point, the updated end point and the target control point, that is, the transition from the initial curve trajectory to the updated curve trajectory, which is used to guide the virtual motion object to move from the current position point to the updated end point.
[0068] In some embodiments, the coordinates of the current position, the updated endpoint, and the target control point are first determined. Based on these points, a preset curve generation method is used to generate a smooth curve trajectory, thereby obtaining an updated curve trajectory for the virtual moving object. The preset curve generation method may be a Bezier curve generation method, and the updated curve trajectory may be an Nth-order Bezier curve, where N is any integer greater than 1. The detailed generation process for the updated curve trajectory is described below.
[0069] Step S105 , controlling the virtual moving object to move along the updated curve trajectory starting from the current position point.
[0070] In embodiments of the present application, the updated curve trajectory of the virtual moving object can be converted into motion instructions, which can include speed, acceleration, steering angle, etc. A motion controller (e.g., a proportional-integral-derivative (PID) controller) is used to execute these motion instructions and adjust the motion state of the virtual moving object. Furthermore, the actual position and curve trajectory of the virtual moving object are monitored, and feedback adjustments are made when necessary to correct the motion.
[0071] The motion control method provided by the embodiment of the present application controls the virtual motion object to move along the initial curve trajectory after generating the initial curve trajectory of the virtual motion object based on multiple control points of the virtual motion object. During the process of the virtual motion object moving along the initial curve trajectory, if the end point among the multiple control points changes, the virtual object cannot continue to move along the initial curve trajectory. At this time, the target control point is determined on the tangent of the initial curve trajectory at the current position point, and the current position point and the updated end point of the virtual motion object are determined. Finally, based on the current position point, the updated end point and the target control point, the updated curve trajectory of the virtual motion object is generated, and the virtual motion object is controlled to move along the updated curve trajectory starting from the current position point. In this way, the virtual motion object can respond to the change of the end point in real time during the process of moving along the initial curve trajectory, and regenerate an updated curve trajectory that meets the requirements based on the updated end point and the target control point, which can ensure the smooth transition between the updated curve trajectory and the initial curve trajectory and ensure the continuity of the curve trajectory of the virtual motion object.
[0072] The following will describe the motion control method in the embodiment of the present application in conjunction with the interaction between the terminal and the server in the motion control system. It should be noted that the motion control method here is a motion control method implemented by the interaction between the terminal and the server, which is essentially the same as the motion control method executed by the server in the above embodiment. The only difference is that the embodiment of the present application also describes the actions performed by the terminal during the execution of the motion control method, and some steps can be executed by both the terminal and the server. Therefore, for the steps in this embodiment that are the same as those in the above embodiment but have different execution entities, this embodiment is only an illustrative description. During the implementation process, they can be executed by any execution entity, and the embodiment of the present application does not limit this.
[0073] Figure 4 This is another optional flow chart of the motion control method provided in the embodiment of the present application, such as Figure 4 As shown, the method includes the following steps S201 to S210:
[0074] Step S201: The terminal receives a motion control operation input by a user.
[0075] In an embodiment of the present application, a motion control application can be run on the terminal, and the user can perform motion control operations on the client of the motion control application. In the motion control application, a motion control function can be provided, and the user can perform motion control operations on the motion control function page to trigger a motion control request.
[0076] In some embodiments, when inputting a motion control operation, the user may also simultaneously input multiple control points of a virtual moving object. When the terminal receives the multiple control points of the virtual moving object, a confirmation motion control window will pop up on the motion control function page. After the terminal detects that the user clicks the confirmation motion control button, the multiple control points of the virtual moving object will be further processed to achieve motion control. Alternatively, in other embodiments, the user may directly input the multiple control points of the virtual moving object on the motion control function page. Upon receiving the multiple control points of the virtual moving object, the terminal may directly trigger the motion control function and further process the multiple control points of the virtual moving object to achieve motion control.
[0077] Step S202: The terminal generates a motion control request in response to the motion control operation.
[0078] In embodiments of the present application, user input data can be encapsulated into a motion control request. For example, a display interface of a motion control application displays multiple control points of a virtual motion object, and the user can select or confirm the multiple control points of the virtual motion object on the display interface according to actual needs. The multiple control points of the virtual motion object input by the user can then be encapsulated into the motion control request.
[0079] Step S203: The terminal sends a motion control request to the server.
[0080] Step S204: The server obtains a plurality of control points of the virtual moving object in response to the motion control request.
[0081] In the embodiment of the present application, for the specific meaning of the step of obtaining multiple control points of the virtual moving object, please refer to the description of step S101 above, and the description will not be repeated here.
[0082] In some embodiments, in response to a motion control request, if the motion control request encapsulates multiple control points of a virtual motion object, the multiple control points of the virtual motion object can be directly parsed and obtained.
[0083] In some embodiments, see Figure 5 , Figure 5 It is shown that in step S204, the server obtains multiple control points of the virtual moving object, which can also be achieved by the following steps S2041 to S2044:
[0084] Step S2041 : in response to receiving a tracking operation for a tracking object, obtaining a starting point of the virtual moving object and a current tracking position of the tracking object.
[0085] In the embodiment of the present application, the tracking object refers to the target object that needs to be tracked by the virtual moving object in the virtual environment. For example, the tracking object can be a moving character or a dynamic target. The tracking operation refers to the behavior of tracking the tracking object initiated by the user or the system, which is usually operated through an input device (for example, a mouse, keyboard or touch screen). The starting point of the virtual object refers to the position of the virtual moving object at the beginning of the movement, that is, the starting point of the movement. The tracking position point refers to the specific position of the tracking object in the virtual environment at the current moment.
[0086] In some embodiments, the method for obtaining the starting point of the virtual moving object and the current tracking position of the tracking object can be that the user specifies the starting point of the virtual moving object and the current tracking position of the tracking object through the operation interface of the terminal, that is, inputs the tracking operation for the tracking object to the terminal, the terminal receives the tracking operation input by the user, generates a tracking request in response to the tracking operation, and encapsulates the starting point of the virtual moving object and the current tracking position of the tracking object into the tracking request, the terminal sends the tracking request to the server, and after receiving the tracking request, the server directly parses the tracking request to obtain the starting point of the virtual moving object specified by the user and the current tracking position of the tracking object. It is also possible that the system automatically detects the position information of the virtual moving object and the tracking object through sensors, that is, obtains the starting point of the virtual moving object and the current tracking position of the tracking object. Alternatively, the position information of the virtual moving object and the tracking object can be obtained through interfaces provided by other software or hardware systems.
[0087] Step S2042: Acquire multiple candidate control points based on a preset curve trajectory curvature coefficient.
[0088] In the embodiments of the present application, the preset curve trajectory curvature coefficient is a pre-set parameter that describes the degree of curvature of the curve trajectory followed by the virtual moving object during tracking. Candidate control points are potential control points preset on the preset curve trajectory, and the candidate control points are used to determine the path of the virtual moving object during tracking.
[0089] In some embodiments, based on a preset curvature coefficient of a curve trajectory, multiple candidate control points can be obtained by using a mathematical model such as a Bezier curve to calculate the candidate control points based on the curvature coefficient of the curve trajectory. Alternatively, an algorithm such as a genetic algorithm or particle swarm optimization can be used to generate candidate control points based on the curvature coefficient of the curve trajectory. Alternatively, a pre-built control point database can be used to search for candidate control points that meet the requirements based on the curvature coefficient of the curve trajectory.
[0090] Step S2043 : determining a plurality of intermediate control points from a plurality of candidate control points based on the starting point and the tracking position of the virtual moving object and the environmental parameters of the virtual environment in which the virtual moving object is located.
[0091] In the embodiments of the present application, the environmental parameters of the virtual environment in which the virtual moving object resides refer to various physical characteristics of the virtual environment in which the virtual moving object resides, such as obstacles, speed limits, or acceleration limits. Intermediate control points are auxiliary control points set between the starting point of the virtual moving object and the current tracking position of the tracking object. Intermediate control points are included in the candidate control points. Intermediate control points are not the actual locations of the virtual moving object, but are used to control and adjust the shape of the curved trajectory of the virtual moving object to make the movement appear more natural and smooth.
[0092] In some embodiments, based on the starting point of the virtual motion object, the tracking position point, and the environmental parameters of the virtual environment in which the virtual motion object is located, a method for determining multiple intermediate control points from multiple candidate control points can be to use an optimization algorithm (e.g., gradient descent or Newton's method, etc.), and screen multiple candidate control points according to the environmental parameters of the virtual environment to find the best intermediate control point that meets the physical characteristics of the virtual environment. It can also be achieved through manual intervention, where the operator can manually select or adjust the control points based on experience and the physical characteristics of the virtual environment, thereby obtaining multiple intermediate control points. It can also be achieved through simulation testing, by simulating the movement of the virtual motion object in the virtual environment, testing different candidate control point combinations, and selecting the best intermediate control point from different candidate control point combinations.
[0093] In step S2044, the starting point, multiple intermediate control points, and tracking position points of the virtual moving object are determined as multiple control points.
[0094] In the embodiment of the present application, the multiple control points include a starting point of the virtual motion object, multiple intermediate control points, and a tracking position point. After obtaining the starting point, multiple intermediate control points, and tracking position point of the virtual motion object, the starting point, multiple intermediate control points, and tracking position point of the virtual motion object can be aggregated to obtain multiple control points.
[0095] Here, obtaining candidate control points through the preset curve trajectory curvature coefficient helps to quickly generate multiple possible motion paths, providing more flexibility to adjust the tracking path of the virtual moving object. The best intermediate control points are selected based on the specific parameters of the virtual environment, so that the motion path is more in line with the limitations and characteristics of the actual environment, such as avoiding obstacles or adapting to specific terrain. The final intermediate control points ensure that the virtual moving object can move smoothly and naturally from the starting point to the tracking position point, while maintaining the beauty and logic of the motion trajectory. In addition, the above steps can also be dynamically adjusted as needed to adapt to the ever-changing virtual environment and tracking requirements.
[0096] Step S205: The server generates an initial curved trajectory of the virtual moving object based on the multiple control points.
[0097] In the embodiment of the present application, for the specific meaning of generating the initial curve trajectory of the virtual motion object based on multiple control points, please refer to the description of step S102 above, and the description will not be repeated here.
[0098] In some embodiments, the plurality of control points include at least: a first control point, a second control point, and a third control point, wherein the third control point is a termination point; Figure 6 , Figure 6 It is shown that in step S205, the server generates an initial curved trajectory of the virtual moving object based on multiple control points, which can be achieved by the following steps S2051 to S2054:
[0099] In step S2051 , a plurality of first continuous points moving from the first control point to the second control point are determined on a first connecting line between the first control point and the second control point according to preset parameters.
[0100] In the embodiment of the present application, the first control point is the starting point of the virtual motion object, and the second control point is an intermediate control point. The first control point and the second control point can be connected to obtain a line between the two, that is, a first line. On the first line, multiple continuously changing points can be found, that is, first continuous points, that is, the first continuous points are continuous points along the first line pointing from the first control point to the second control point. On the first line, the straight line equation of the straight line where the first line is located can be used as the moving trajectory equation of multiple first continuous points. Among them, the change parameters of the multiple first continuous points can be preset parameters, and the value range of the preset parameters is between 0 and 1. For example, assuming that the first control point is A, the second control point is B, and the changed first continuous point is a, then the first line is line segment AB, the changed line segment is Aa, and the preset parameter t is the ratio between the changed line segment Aa and the first line AB.
[0101] In step S2052 , a plurality of second continuous points moving from the second control point to the third control point are determined on a second connecting line between the second control point and the third control point according to preset parameters.
[0102] In this embodiment of the present application, the third control point is the end point, i.e., the tracking location point where the tracked object is currently located. The second control point and the third control point can be connected to form a line between them, i.e., a second line. Multiple continuously changing points, i.e., second continuous points, can be found on the second line. These second continuous points are continuous points along the second line in the direction from the second control point to the third control point. The equation of the line on which the second line lies can be used as the trajectory equation for the multiple second continuous points. The changing parameters of the multiple second continuous points can be preset parameters, with a value range of 0 to 1. For example, continuing with the example in step S2051 above, if the second control point is B, the third control point is C, and the changing second continuous point is b, then the second line is line segment BC, the changing line segment is Bb, and the preset parameter t is the ratio between the changing line segment Bb and the second line BC. Furthermore, the ratio between the changing line segment Aa and the first line AB is equal to the ratio between the changing line segment Bb and the second line BC, which is equal to the preset parameter. Each first continuous point corresponds to a second continuous point.
[0103] Step S2053 : For each first continuous point, a third continuous point moving from the first continuous point to the second continuous point is determined on a third line between the first continuous point and the corresponding second continuous point according to preset parameters, thereby obtaining a plurality of third continuous points.
[0104] In an embodiment of the present application, a first continuous point can be connected to a corresponding second continuous point to obtain a line between the two, i.e., a third line. Multiple continuously changing points, i.e., third continuous points, can be found on the third line. In other words, the third continuous point is a continuous point along the third line pointing from the first continuous point to the second continuous point. On the third line, the equation of the line on which the third line lies can be used as the equation of the movement trajectory of the multiple third continuous points. The changing parameters of the multiple third continuous points can be preset parameters, and the value range of the preset parameters is between 0 and 1. For example, continuing with the example in step S2052 above, assuming that the changing third continuous point is c, the third line is line segment ab, the changing line segment is ac, and the preset parameter t is the ratio between the changing line segment ac and the third line ab. Furthermore, the ratio between the changing line segment Aa and the first line AB is equal to the ratio between the changing line segment Bb and the second line BC, and equal to the ratio between the changing line segment ac and the third line ab, which is equal to the preset parameter.
[0105] Step S2054: sequentially connect the first control point, multiple third continuous points, and the third control point to obtain an initial curve trajectory.
[0106] In the embodiment of the present application, after obtaining the first control point, the plurality of third consecutive points, and the third control point, the first control point, the plurality of third consecutive points, and the third control point are sequentially connected to obtain an initial curve trajectory of the virtual moving object. The initial curve trajectory is a quadratic Bezier curve.
[0107] Here, by setting multiple continuous points between adjacent control points, the initial curve trajectory of the virtual motion object can be more accurately defined, and the initial curve trajectory can be refined so that the subsequent control of the virtual motion object to move along the initial curve trajectory is smoother and more natural.
[0108] In some embodiments, the initial curve trajectory of the virtual motion object can also be a cubic Bezier curve, and the multiple control points can also include at least: a first control point, a second control point, a third control point and a fourth control point, with the fourth control point being the end point. The server generates the initial curve trajectory of the virtual motion object based on the multiple control points, and can also be implemented in the following manner: on the first line between the first control point and the second control point, according to preset parameters, determine multiple first continuous points moving from the first control point to the second control point; on the second line between the second control point and the third control point, according to preset parameters, determine multiple second continuous points moving from the second control point to the third control point; each first continuous point corresponds to a second continuous point; on the third line between the third control point and the fourth control point, according to preset parameters, determine multiple third continuous points moving from the third control point to the fourth control point; each second continuous point corresponds to a third continuous point; for each first continuous point, on the first line On a fourth line between the continuous point and the corresponding second continuous point, a fourth continuous point is determined to move from the first continuous point to the second continuous point according to preset parameters, thereby obtaining a plurality of fourth continuous points; on a fifth line between the second continuous point and the corresponding third continuous point, a fifth continuous point is determined to move from the second continuous point to the third continuous point according to preset parameters, thereby obtaining a plurality of fifth continuous points; each fourth continuous point corresponds to a fifth continuous point; on a sixth line between the fourth continuous point and the corresponding fifth continuous point, a sixth continuous point is determined to move from the fourth continuous point to the fifth continuous point according to preset parameters, thereby obtaining a plurality of sixth continuous points; and the first control point, the plurality of sixth continuous points, and the third control point are sequentially connected to obtain an initial curve trajectory. The generation principle of a cubic Bezier curve is similar to that of a quadratic Bezier curve, i.e., the generation process of a cubic Bezier curve can refer to the generation process of a quadratic Bezier curve described above, and will not be repeated here. It should be noted that the initial curve trajectory of the virtual moving object can also be a higher-order Bezier curve. The order of the Bezier curve can be selected according to actual conditions and is not specifically limited here.
[0109] In step S206 , in response to a change in an end point among the multiple control points when the virtual moving object is controlled to move along the initial curved trajectory, the server obtains the current position point, the updated end point, and the target control point of the virtual moving object.
[0110] In an embodiment of the present application, the target control point is located on the tangent of the initial curve trajectory at the current position point; in response to controlling the virtual motion object to move along the initial curve trajectory, the end point among the multiple control points changes, and the current position point, updated end point and target control point of the virtual motion object are obtained. The specific meaning of this step can be explained in the description of step S103 above, and will not be repeated here.
[0111] In some embodiments, see Figure 7 , Figure 7 In step S206, the server obtains the current position point, updated end point, and target control point of the virtual moving object in response to a change in the end point among the multiple control points when controlling the virtual moving object to move along the initial curved trajectory. This can be achieved by the following steps S2061 to S2063:
[0112] Step S2061 : In response to controlling the virtual moving object to move along the initial curved trajectory, obtaining a moving speed of a tracking object of the virtual moving object.
[0113] In an embodiment of the present application, after obtaining the initial curved trajectory of the virtual moving object, the server can control the virtual moving object to move along the initial curved trajectory. In response to controlling the virtual moving object to move along the initial curved trajectory, the end point of the multiple control points changes, that is, the position point of the tracking object of the virtual moving object changes, and the movement speed of the tracking object is detected to obtain the movement speed of the tracking object. The movement speed of the tracking object can be 0, in which case the tracking object remains stationary after changing its position; the movement speed of the tracking object can also be any value greater than 0, in which case the tracking object is in dynamic motion, that is, the position point of the tracking object changes at all times.
[0114] Step S2062: Determine the time interval for updating the curved trajectory of the virtual moving object based on the moving speed.
[0115] In the embodiment of the present application, the time interval for updating the curved trajectory of the virtual moving object refers to a period of time at which the curved trajectory of the virtual moving object is updated according to the movement speed of the tracking object when the virtual moving object moves along the curved trajectory.
[0116] In some embodiments, the method for determining the time interval for updating the curved trajectory of the virtual moving object based on the movement speed can be: when the movement speed of the tracking object is 0, a fixed time interval can be set, and every time interval it is detected whether the tracking position point where the tracking object is currently located has changed, and whether the curved trajectory of the virtual moving object needs to be updated. When the tracking object is in dynamic motion, an adaptive algorithm can be used to dynamically adjust the time interval according to the movement speed of the tracking object. For example, a PID controller or fuzzy logic can be used to adjust the time interval according to the change in the movement speed of the tracking object. A speed threshold can also be set. When the movement speed of the tracking object exceeds the speed threshold, the time interval is reduced to increase the update frequency of the curved trajectory of the virtual moving object; when the movement speed of the tracking object is lower than the speed threshold, the time interval is increased to reduce the update frequency of the curved trajectory of the virtual moving object. There is no specific limitation on the setting of the time interval.
[0117] Step S2063 : obtaining the current position point of the virtual moving object, the current tracking position point of the tracking object, and the target control point at every time interval.
[0118] In the embodiment of the present application, the current tracking position of the tracked object is the updated end point. After the time interval for updating the curve trajectory of the virtual moving object is determined, the current position of the virtual moving object, the current tracking position of the tracked object, and the target control point are automatically detected to determine whether the curve trajectory of the virtual moving object needs to be updated.
[0119] Here, updating the curve trajectory based on the speed of the tracked object improves the accuracy of the virtual object's motion, making it more realistic. Furthermore, setting a reasonable time interval ensures smooth motion and avoids abrupt movements. It also enables rapid response to changes in the speed of the tracked object, allowing the virtual object to adjust its trajectory to accommodate the new target.
[0120] In some embodiments, see Figure 8 , Figure 8 It is shown that in step S206, the server obtains the target control point of the virtual moving object, which can be achieved by the following steps S2064 to S2067:
[0121] Step S2064: Obtain the target first continuous point and target second continuous point corresponding to the current position point.
[0122] In an embodiment of the present application, when controlling a virtual moving object to move along an initial curved trajectory, the current position of the virtual moving object is one of a plurality of third continuous points, and the third continuous point corresponds to a first continuous point and a second continuous point, namely, a target first continuous point and a target second continuous point corresponding to the current position. The fourth line between the target first continuous point and the target second continuous point overlaps with the tangent of the initial curved trajectory at the current position. When the current position of the virtual moving object is determined, the target first continuous point and the target second continuous point corresponding to the current position can be determined.
[0123] Step S2065: Determine the distance between the second target continuous point and the third control point.
[0124] Step S2066: In response to the distance value being greater than the preset distance threshold, the target second continuous point is determined as a target control point.
[0125] In an embodiment of the present application, the preset distance threshold is a reference distance value set during the curve trajectory update process of the virtual motion object, and is used to determine whether the distance between the second continuous target point and the third control point is large enough, thereby determining whether the second continuous target point needs to be used as a new target control point, or whether a new target control point needs to be found on the extension line of the fourth line. First, the distance value between the second continuous target point and the third control point is calculated using a distance calculation formula. Then, the distance value is compared with the preset distance threshold. If the distance value is greater than the preset distance threshold, it indicates that the distance between the second continuous target point and the third control point is large enough. The second continuous target point can be directly determined as the target control point and used in the subsequent curve trajectory update process of the virtual motion object.
[0126] Step S2067 : In response to the distance value being less than or equal to the preset distance threshold, a target control point is determined on the extension line of the fourth line.
[0127] In an embodiment of the present application, if the distance value is less than or equal to a preset distance threshold, it means that the distance between the target second continuous point and the third control point is small, and a new target control point needs to be determined on the extension line of the fourth line (i.e., the extension line of the direction of the line between the target first continuous point and the target second continuous point). The direction of the extension line is from the target first continuous point to the target second continuous point. The selection of the target control point on the extension line of the fourth line depends on specific needs and is not specifically limited here. The different positions of the target control points will result in differences in the updated curve trajectory, but the updated curve trajectory and the initial curve trajectory must be smoothly connected at the junction.
[0128] Here, when the initial curve trajectory of the virtual motion object is a quadratic Bezier curve, the target control point can be dynamically adjusted according to the distance value between the target second continuous point and the third control point corresponding to the current position point of the virtual motion object, thereby ensuring that the motion trajectory of the virtual motion object is continuous and smooth, and avoiding abrupt changes during the motion process.
[0129] In some embodiments, when the initial curve trajectory of the virtual motion object is a cubic Bezier curve, the target control points further include a first target control point and a second target control point. The server obtains the target control point of the virtual moving object, which can also be achieved by the following manner: obtaining the target fourth continuous point and the target fifth continuous point corresponding to the current position point; the sixth connecting line between the target fourth continuous point and the target fifth continuous point overlaps with the tangent of the initial curve trajectory at the current position point; obtaining the target second continuous point and the target third continuous point corresponding to the target fifth continuous point; determining a first distance value between the target fifth continuous point and the target third continuous point; determining a second distance value between the target third continuous point and the third control point; in response to the first distance value being greater than a preset distance threshold, determining the target fifth continuous point as the first target control point; in response to the second distance value being greater than the preset distance threshold, determining the target third continuous point as the second target control point; in response to the first distance value being less than or equal to the preset distance threshold, determining the target control point on a first extension line of the sixth connecting line; the direction of the first extension line is from the target fourth continuous point to the target fifth continuous point; in response to the second distance value being less than or equal to the preset distance threshold, determining the target control point on a second extension line of the seventh connecting line between the target second continuous point and the target third continuous point; the direction of the second extension line is from the target second continuous point to the target third continuous point. The method for determining target control points for a cubic Bezier curve is similar to that for a quadratic Bezier curve. The target control point determination process for a cubic Bezier curve can be referenced to the target control point determination process for a quadratic Bezier curve, and will not be repeated here. It should be noted that when the initial curve trajectory of the virtual motion object is a higher-order Bezier curve, the corresponding target control point determination process can also be referenced to the above description.
[0130] In some embodiments, the server obtains the updated end point of the virtual moving object in the following manner: in response to controlling the virtual moving object to move along the initial curve trajectory, the current tracking object corresponding to the initial curve trajectory disappears, and a new tracking object is determined; the current position of the new tracking object is determined as the updated end point.
[0131] In an embodiment of the present application, in response to the current tracking object corresponding to the initial curved trajectory disappearing while controlling a virtual moving object to move along an initial curved trajectory, the new tracking object can be determined in the following ways: First, the user can manually select a new tracking object through the interface. For example, in a game, the user might click on a new target object to set it as the tracking object. Second, a sensor or algorithm can automatically detect new target objects in the environment and set them as tracking objects. For example, a vision-based algorithm can identify approaching enemies or friendly units in the virtual environment and identify the approaching enemies as new tracking objects. Third, a new tracking object can be automatically selected based on preset rules or conditions. For example, the next closest or most relevant tracking object can be selected based on the type, importance, or distance of the tracking object. Fourth, a new tracking object can be determined based on an event trigger. The occurrence of certain events can trigger the selection of a new tracking object. For example, the system will trigger the selection of a new tracking object upon the death of a character or the completion of a mission. Methods for determining a new tracking object include, but are not limited to, the methods listed above and are not specifically limited here. After the new tracking object is determined, the current position of the new tracking object is detected and determined as the updated end point, so that the curve trajectory of the virtual moving object is subsequently updated according to the updated end point.
[0132] When the tracking object corresponding to the initial curved trajectory disappears, a new tracking object can be quickly determined, maintaining continuous tracking of the virtual moving object and avoiding tracking interruptions. This provides the ability to flexibly select tracking objects in different situations, adapting to dynamically changing environments and unpredictable events. The ability to promptly update the tracking object helps provide a more immersive and realistic experience, increasing user engagement and satisfaction.
[0133] In some embodiments, in response to controlling the virtual moving object to move along the initial curved trajectory, the current tracking object corresponding to the initial curved trajectory disappears, and the movement of the virtual moving object along the initial curved trajectory stops.
[0134] In the embodiment of the present application, the disappearance of the currently tracked object corresponding to the initial curved trajectory may be due to the current tracking object being removed or blocked. In response to controlling the virtual moving object to move along the initial curved trajectory, the currently tracked object corresponding to the initial curved trajectory disappears, and continuing to move along the initial curved trajectory becomes meaningless. Stopping the movement of the virtual moving object along the initial curved trajectory can avoid unnecessary calculations and resource waste.
[0135] In gaming or simulation environments, the disappearance of a tracked object often signals a change in some event or condition. Immediately stopping the motion of a virtual moving object enhances the scene's realism. Continuing along the initial curved trajectory can lead to erroneous decisions or actions, which can be prevented by stopping the object promptly.
[0136] In step S207 , the server generates an updated curve trajectory of the virtual moving object based on the current position point, the updated end point and the target control point.
[0137] In an embodiment of the present application, for generating an updated curve trajectory of a virtual motion object based on the current position point, the updated end point and the target control point, the specific meaning of this step can be explained in the description of step S104 above, and will not be repeated here.
[0138] In some embodiments, see Figure 9 , Figure 9 It is shown that in step S207, the server generates an updated curve trajectory of the virtual moving object based on the current position point, the updated end point and the target control point, which can be achieved by the following steps S2071 to S2074:
[0139] Step S2071 : determining a plurality of fourth consecutive points moving from the current position point to the target control point on a fifth connecting line between the current position point and the target control point according to preset parameters.
[0140] In the embodiment of the present application, the current position point is the starting point of the updated curve trajectory generated for the virtual motion object, and the target control point is an intermediate control point. The current position point and the target control point can be connected to obtain a line between the two, that is, the fifth line. On the fifth line, multiple continuously changing points can be found, that is, the fourth continuous points. That is, the fourth continuous points are continuous points along the fifth line pointing from the current position point to the target control point. On the fifth line, the straight line equation of the straight line where the fifth line is located can be used as the moving trajectory equation of the multiple fourth continuous points. Among them, the change parameters of the multiple fourth continuous points can be preset parameters, and the value range of the preset parameters is between 0 and 1. For example, assuming that the current position point is D, the target control point is E, and the changing fourth continuous point is d, then the fifth line is line segment DE, the changing line segment is Dd, and the preset parameter t is the ratio between the changing line segment Dd and the fifth line DE.
[0141] Step S2072: determining a plurality of fifth consecutive points moving from the target control point to the updated end point on a sixth line between the target control point and the updated end point according to preset parameters.
[0142] In an embodiment of the present application, the target control point and the updated endpoint can be connected to obtain a line between the two, i.e., the sixth line. Multiple continuously changing points, i.e., fifth continuous points, can be found on the sixth line. In other words, the fifth continuous points are continuous points along the sixth line in the direction from the target control point to the updated endpoint. On the sixth line, the equation of the line on which the sixth line lies can be used as the movement trajectory equations of the multiple fifth continuous points. The changing parameters of the multiple fifth continuous points can be preset parameters, and the value range of the preset parameters is between 0 and 1. For example, continuing with the example in step S2071 above, assuming the updated endpoint is F and the changed fifth continuous point is e, the sixth line is line segment EF, the changed line segment is Ee, and the preset parameter t is the ratio between the changed line segment Ee and the sixth line EF. Furthermore, the ratio between the changed line segment Dd and the fifth line DE is equal to the ratio between the changed line segment Ee and the sixth line EF, which is equal to the preset parameter. Each fourth continuous point corresponds to a fifth continuous point.
[0143] Step S2073 : For each fourth continuous point, a sixth continuous point moving from the fourth continuous point to the fifth continuous point is determined on the seventh line between the fourth continuous point and the corresponding fifth continuous point according to preset parameters, thereby obtaining a plurality of sixth continuous points.
[0144] In this embodiment of the present application, a fourth continuous point can be connected to a corresponding fifth continuous point to obtain a line between the two, i.e., a seventh line. Multiple continuously changing points, i.e., sixth continuous points, can be found on the seventh line. Specifically, the sixth continuous points are continuous points along the seventh line in a direction from the fourth continuous point to the fifth continuous point. On the seventh line, the equation of the line on which the seventh line lies can be used as the trajectory equations for the multiple sixth continuous points. The changing parameters of the multiple sixth continuous points can be preset parameters, with values ranging from 0 to 1. For example, continuing with the example in step S2072 above, assuming the changing sixth continuous point is f, the seventh line is line segment de, the changing line segment is df, and the preset parameter t is the ratio between the changing line segment df and the seventh line de. Furthermore, the ratio between the changing line segment Dd and the fifth line DE is equal to the ratio between the changing line segment Ee and the sixth line EF, which is equal to the ratio between the changing line segment df and the seventh line de, which is equal to the preset parameter.
[0145] Step S2074: sequentially connect the current position point, multiple sixth consecutive points, and the updated end point to obtain an updated curve trajectory.
[0146] In the embodiment of the present application, after obtaining the current position point, the plurality of sixth consecutive points, and the updated end point, the current position point, the plurality of sixth consecutive points, and the updated end point are sequentially connected to obtain an updated curve trajectory of the virtual moving object. The updated curve trajectory is a quadratic Bezier curve.
[0147] By setting multiple continuous points between the current position, the target control point, and the updated endpoint, the updated curve trajectory of the virtual moving object can be more precisely defined, allowing for a more refined update curve trajectory. This allows for smoother and more natural movement of the virtual moving object along this updated curve trajectory. Furthermore, the curve trajectory maintains a smooth transition when the endpoint changes, ensuring the continuity and naturalness of the virtual moving object's motion path.
[0148] In some embodiments, the updated curve trajectory of the virtual motion object can also be a cubic Bezier curve. Based on the current position point, the updated end point and the target control point, the updated curve trajectory of the virtual motion object is generated, which can also be achieved in the following way: on the eighth line between the current position point and the first target control point, according to the preset parameters, multiple seventh consecutive points moving from the current position point to the first target control point are determined; on the ninth line between the first target control point and the second target control point, according to the preset parameters, multiple eighth consecutive points moving from the first target control point to the second target control point are determined; wherein each seventh consecutive point corresponds to an eighth consecutive point; on the tenth line between the second target control point and the updated end point, according to the preset parameters, multiple eighth consecutive points moving from the second target control point to the second target control point are determined; wherein each seventh consecutive point corresponds to an eighth consecutive point; Multiple ninth consecutive points are determined to the updated end point, wherein each eighth consecutive point corresponds to a ninth consecutive point. For each seventh consecutive point, multiple tenth consecutive points are determined on the eleventh line between the seventh and eighth consecutive points according to preset parameters, moving from the seventh to the eighth consecutive point. For each eighth consecutive point, multiple eleventh consecutive points are determined on the twelfth line between the eighth and ninth consecutive points according to preset parameters, moving from the eighth to the ninth consecutive point. Each tenth consecutive point corresponds to an eleventh consecutive point. For each tenth consecutive point, a twelfth consecutive point is determined on the thirteenth line between the tenth consecutive point and the corresponding eleventh consecutive point according to preset parameters, moving from the tenth to the eleventh consecutive point, to obtain multiple twelfth consecutive points. The current position point, the multiple twelfth consecutive points, and the updated end point are sequentially connected to obtain an updated curve trajectory. The updating principle of a cubic Bezier curve is similar to that of a quadratic Bezier curve. That is, the updating process of a cubic Bezier curve can refer to the updating process of a quadratic Bezier curve described above and will not be repeated here. It should be noted that the update curve trajectory of the virtual motion object can also be a higher-order Bezier curve. The order of the Bezier curve can be selected according to actual conditions and is not specifically limited here.
[0149] Step S208: The server controls the virtual moving object to move along the updated curve trajectory starting from the current position point to obtain a motion control result.
[0150] In the embodiment of the present application, for controlling the virtual moving object to move along the updated curve trajectory starting from the current position point, the specific meaning of this step can be explained in the description of step S105 above, and will not be repeated here.
[0151] The motion control result is the final state and effect achieved by the virtual object, following control commands, as it moves from its current position along the updated curve trajectory. During the virtual object's movement along the updated curve trajectory, the motion control result can be characterized by the following aspects: Whether the virtual object precisely follows the predetermined trajectory without deviation; Whether the movement is smooth, without jitter or oscillation; The speed and accuracy of the virtual object's response to control commands; The continuity of the motion trajectory, that is, whether the virtual object's movement is smooth, without interruptions or jumps; And whether the virtual object reaches the designated end point, etc.
[0152] Step S209: The server sends the motion control result to the terminal.
[0153] Step S210: The terminal outputs the motion control result.
[0154] In an embodiment of the present application, when performing motion control, by using the Bezier curve generation and update method, new control points that meet the requirements are selected, and the curve trajectory of the virtual motion object is accurately calculated and adjusted in real time. Whether in the process of switching the tracking object or in the process of moving the tracking object, the curve trajectory of the virtual motion object appears natural and coherent. This smooth transition of the curve trajectory enhances the fluency of the game, allowing users to enjoy a more immersive gaming experience. In addition, when the tracking object changes or disappears, the virtual motion object can be quickly adjusted and will not continue to execute an invalid path due to the loss of the tracking object. This intelligent processing can reduce the frustration caused by incorrect operations, reduce the user's operating pressure, and improve the playability and user satisfaction of the game.
[0155] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.
[0156] The embodiment of the present application provides an intelligent smoothing method for the trajectory of an arbitrary multi-point flying object based on curve fitting, which applies a trajectory generation and adjustment algorithm based on a Bezier curve. By adjusting the control points of the Bezier curve, the tangents of the trajectory of the flying object are collinear when the target is constantly changing, so that the transition is smooth. This method can be applied to eliminate flying objects in the game, especially flying objects with tracking properties to achieve a natural and smooth transition of their own trajectories when dynamic targets are switched. The method supports trajectory re-planning. When the flying object is flying towards a predetermined target position, if a sudden target change occurs (for example, a target switch, or the target is in an unpredictable motion state), it can seamlessly switch to a new trajectory and keep its own motion curve smooth. This method solves the problem of trajectory connection when the flying object target is switched concisely and efficiently, and significantly improves the continuity and naturalness of the flying object's motion trajectory.
[0157] In the embodiments of the present application, a propeller with intelligent tracking characteristics is designed. After the user activates the propeller, the propeller will select a target in the game and fly to it along a certain curved trajectory to hit the target. This propeller has intelligent tracking characteristics, which is mainly reflected in the following two aspects: On the one hand, when the target element changes position or is in motion, the propeller can smoothly and naturally adjust its flight trajectory, always chasing the target element until it is hit. On the other hand, when the target element suddenly disappears, the propeller can switch to a new target in time and smoothly and naturally adjust its flight curve to fly towards the new target, without having to fly to the original target position and then fly to the new target according to the original flight plan. Moreover, because the propeller supports dynamic adjustment of its trajectory curve at any time, the player's real-time operation will not have an uncontrollable impact on the propeller's flight throughout the game. The player can perform free operations at any time. For example, during the propeller's flight, the target element can be eliminated directly or indirectly through various methods, effectively optimizing the human-computer interaction method in the game.
[0158] Intelligently smoothing the propeller tracking curve significantly enhances the user experience. Because the propellers can autonomously adjust their trajectory, players no longer need to worry about operational complications caused by changing targets. This seamless experience makes the game more immersive and enjoyable. Furthermore, the dynamic target tracking and switching mechanism makes players feel the game's intelligence and efficiency. This technology also reduces the frustration caused by incorrect operations, allowing players to focus more on strategy and goal achievement, thereby increasing game stickiness and user retention.
[0159] The trajectory curve of the propeller is generated by the Bezier curve, and the take-off position of the propeller is regarded as the starting point of the trajectory curve, and the target position of the propeller is regarded as the end point of the trajectory curve. For example, a third-order Bezier curve with four control points can be selected as the flight trajectory of the propeller from the starting point to the end point. Here, the Bezier curve is defined in a recursive way (that is, the idea of the de Casteljau algorithm). The idea of the de Casteljau algorithm is to take the line connecting each control point, and generate a new control point at the t (value range 0-1) position of each connecting line and continue to connect the lines with the new control points until the t position of the last connecting line is the t (value range 0-1) point coordinate of the entire Bezier curve. For a first-order Bezier curve, it has a starting point P_0 = (x_0, y_0) and an end point P_1 = (x_1, y_1). The curve equation is: P(t) = P_0 + (P_1-P_0)t = (1-t)P_0 + tP_1; the value range of t is [0, 1]. A first-order Bezier curve is a straight line. The schematic diagram of a first-order Bezier curve is as follows: Figure 10 shown.
[0160] For the second-order Bezier curve, the second-order Bezier curve has three control points P_0, P_1 and P_2. Consider the first-order Bezier curve P_0(t) obtained by P_0 and P_1, and the first-order Bezier curve P_1(t) obtained by P_1 and P_2 respectively. For the same certain t value, two points P_0(t) and P_1(t) are determined. Consider the first-order Bezier curve P(t) obtained by P_0(t) and P_1(t).
[0161] When t goes from 0 to 1, the trajectory of P(t) is the second-order Bezier curve obtained by the three control points P_0, P_1 and P_2. The schematic diagram of the second-order Bezier curve is as follows Figure 11 shown.
[0162] For a third-order Bezier curve, there are four control points P_0, P_1, P_2, and P_3. The first-order Bezier curve P_0(t) is obtained from P_0 and P_1, the first-order Bezier curve P_1(t) is obtained from P_1 and P_2, the first-order Bezier curve P_2(t) is obtained from P_2 and P_3, the first-order Bezier curve P_01(t) is obtained from P_0(t) and P_1(t), the first-order Bezier curve P_12(t) is obtained from P_1(t) and P_2(t), and the first-order Bezier curve P(t) is obtained from P_01(t) and P_12(t). When t ranges from 0 to 1, the trajectory of P(t) is the third-order Bezier curve obtained by the four control points P_0, P_1, P_2, and P_3.
[0163] In general, consider an N-order Bezier curve with N+1 control points P_0, ..., P_N; consider a Bezier curve obtained by two control points P_i and P_{i+1}, where i = 0, ..., N-1; and generate N new control points P^1_i(t) according to the ideas described above.
[0164] Continue to consider the new control point P^2_i(t)(i=0,...,N-2) generated by P^1_i and P^1_{i+1}; consider the new control point P^{s+1}_i(t)(i=0,...,Ns-1) generated by P^s_i and P^s_{i+1}; consider the new control point P^{N-2}_i and P^{N-2}_{i+1} generated by P^{N-1}_i(t)(i=0,1); P(t)=P^N(t) determined by the two points P^{N-1}_0(t) and P^{N-1}_1(t) is the N-order Bezier curve determined by the N+1 control points P_0,...,P_N.
[0165] To achieve smooth transitions in trajectory curves when switching targets or moving them, it's important to understand how tangents work in Bezier curves. It can be shown that the Nth-order derivative at the starting and ending points of a Bezier curve is only related to the N+1 adjacent control points, and the slope of the starting and ending points is simply the line connecting the two adjacent control points. The directions of the two control points at the last level of De Castellio's recursive algorithm are the directions of the tangents at that point.
[0166] Consider N+1 control points P_0, ..., P_N. A propeller starts from its starting point P_0 and flies to its end point P_N along the trajectory of the Nth-order Bezier curve defined by these N+1 control points. The propeller's trajectory is denoted as P(t), and its position at t=t_0 is denoted as P(t_0). In the process described by the De Castellio algorithm, the two final control points P^{N-1}_0(t_0) and P^{N-1}_1(t_0) are obtained. The straight line containing these two control points is the tangent to the Bezier curve P(t) at t_0. Furthermore, the line connecting control points P_0 and P_1 is the tangent to the Nth-order Bezier curve at P_0=P(0), and the line connecting control points P_{N-1} and P_N is the tangent to the Nth-order Bezier curve at P_N=P(1).
[0167] When the propeller has not reached the end point, if a target switch occurs, it is necessary to select a new control point at the appropriate position on the straight line connecting the two control points of the last level in the De Castellio recursive algorithm as the first control point of the new Bezier trajectory curve (if the starting point is regarded as the first control point, this is the second control point) to ensure that the new trajectory curve and the old trajectory curve can be smoothly connected.
[0168] Take the second-order Bezier curve as an example (the same applies to higher-order Bezier curves, not limited to the second-order Bezier curve), such as Figure 12 As shown. Figure 12 In the equation, P(t) is the second-order Bezier curve determined by the three control points P_0, P_1, and P_2; P_0(t) is the new control point generated when P_0 and P_1 determine the first-order Bezier curve; P_1(t) is the new control point generated when P_1 and P_2 determine the first-order Bezier curve;
[0169] According to the above, the straight line where P_0(t) and P_1(t) are located is the tangent line of P(t) at point t; now it is known that the propeller has flown to the position of Figure 12If the position of P(t) in the equation is suddenly changed to point Q for some reason, we only need to take point Q_0 somewhere on the straight line where P_0(t) and P_1(t) are located, consider the Bezier curve Q(t') generated by the three control points P(t), Q_0 and Q, and let the propeller start from P(t) and fly to point Q along the trajectory of Q(t'). As mentioned above, Q(t') and P(t) are tangent at t'=0.
[0170] The selection of Q_0 depends on specific needs and there is no fixed standard. For example, when P_1(t) is far from P_2 (that is, when 1-t>r>0 for some value of r), one can directly choose Q_0 = P_1(t). When P_1(t) is very close to P_2, the value can be taken along the line extending from P_0(t) to P_1(t). Different positions of Q_0 will result in different new trajectory curves, but the new and old curves must be smoothly connected at the junction.
[0171] When the target being tracked by the propeller is in constant motion, the target's position is constantly changing. In this case, the propeller needs to adjust its flight trajectory at regular intervals. The method for adjusting the flight trajectory each time is similar to the above. You only need to pay attention to the time interval between each adjustment, which should be inversely proportional to the target's moving speed.
[0172] In summary, by applying Bezier curves and the De Castellio algorithm, we successfully implemented intelligent propeller tracking. This technical solution enables smooth propeller trajectory transitions during target switching and movement, ensuring a continuous and natural flight path. By flexibly adjusting the control point and trajectory curve parameters, the flight trajectory can be optimized in real time based on target changes in the actual game scenario. This intelligent implementation not only enhances the game's dynamic performance and visual effects, but also significantly enhances the user experience and game flow, allowing players to focus more on game strategy and the fun itself.
[0173] It can be understood that in the embodiments of the present application, the content involving user information, such as the initial curve trajectory, updated curve trajectory, and target control point information, if it involves data related to user information or enterprise information, when the embodiments of the present application are applied to specific products or technologies, it is necessary to obtain user permission or consent, or to blur this information to eliminate the correspondence between this information and the user; and the relevant data collection and processing should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0174] The following continues to describe the exemplary structure of the motion control device 455 provided in the embodiment of the present application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the motion control device 455 of the memory 450 may include: a first acquisition module 4551, used to acquire multiple control points of the virtual motion object; a first generation module 4552, used to generate an initial curve trajectory of the virtual motion object based on the multiple control points; a second acquisition module 4553, used to acquire the current position point, updated end point and target control point of the virtual motion object in response to a change in the end point of the multiple control points when controlling the virtual motion object to move along the initial curve trajectory; the target control point is located on the tangent of the initial curve trajectory at the current position point; a second generation module 4554, used to generate an updated curve trajectory of the virtual motion object based on the current position point, the updated end point and the target control point; a control module 4555, used to control the virtual motion object to move along the updated curve trajectory starting from the current position point.
[0175] In some embodiments, the multiple control points include at least: a first control point, a second control point and a third control point; the third control point is the termination point; the first generation module 4552 is also used to: on the first line between the first control point and the second control point, according to preset parameters, determine multiple first continuous points moving from the first control point to the second control point; on the second line between the second control point and the third control point, according to preset parameters, determine multiple second continuous points moving from the second control point to the third control point; wherein, each first continuous point corresponds to a second continuous point; for each first continuous point, on the third line between the first continuous point and the corresponding second continuous point, according to preset parameters, determine a third continuous point moving from the first continuous point to the second continuous point, to obtain multiple third continuous points; connect the first control point, the multiple third continuous points and the third control point in sequence to obtain the initial curve trajectory.
[0176] In some embodiments, the second acquisition module 4553 is also used to: acquire the target first continuous point and the target second continuous point corresponding to the current position point; the fourth line between the target first continuous point and the target second continuous point overlaps with the tangent of the initial curve trajectory at the current position point; determine the distance value between the target second continuous point and the third control point; in response to the distance value being greater than a preset distance threshold, determine the target second continuous point as the target control point; in response to the distance value being less than or equal to the preset distance threshold, determine the target control point on the extension line of the fourth line; the direction of the extension line is from the target first continuous point to the target second continuous point.
[0177] In some embodiments, the second generation module 4554 is further used to: determine, on the fifth line between the current position point and the target control point, a plurality of fourth continuous points moving from the current position point to the target control point according to the preset parameters; determine, on the sixth line between the target control point and the updated end point, a plurality of fifth continuous points moving from the target control point to the updated end point according to the preset parameters; wherein each fourth continuous point corresponds to a fifth continuous point; for each fourth continuous point, determine, on the seventh line between the fourth continuous point and the corresponding fifth continuous point, a sixth continuous point moving from the fourth continuous point to the fifth continuous point according to the preset parameters, to obtain a plurality of sixth continuous points; and sequentially connect the current position point, the plurality of sixth continuous points and the updated end point to obtain the updated curve trajectory.
[0178] In some embodiments, the second acquisition module 4553 is also used to: in response to controlling the virtual motion object to move along the initial curved trajectory, obtain the motion speed of the tracking object of the virtual motion object; based on the motion speed, determine the time interval for updating the curved trajectory of the virtual motion object; every time interval, obtain the current position point of the virtual motion object, the tracking position point where the tracking object is currently located, and the target control point; wherein, the tracking position point is the updated end point.
[0179] In some embodiments, the first acquisition module 4551 is also used to: in response to receiving a tracking operation for a tracking object, obtain the starting point of the virtual motion object and the tracking position point where the tracking object is currently located; based on a preset curve trajectory bending coefficient, obtain multiple candidate control points; based on the starting point of the virtual motion object, the tracking position point and the environmental parameters of the virtual environment in which the virtual motion object is located, determine multiple intermediate control points from the multiple candidate control points; and determine the starting point of the virtual motion object, the multiple intermediate control points and the tracking position point as the multiple control points.
[0180] In some embodiments, the second acquisition module 4554 is also used to: in response to controlling the virtual moving object to move along the initial curve trajectory, the current tracking object corresponding to the initial curve trajectory disappears, and a new tracking object is determined; and the current position point of the new tracking object is determined as the updated end point.
[0181] In some embodiments, the device 455 further includes a stop module, which is used to: in response to controlling the virtual moving object to move along the initial curve trajectory, the current tracking object corresponding to the initial curve trajectory disappears, and stop the movement of the virtual moving object along the initial curve trajectory.
[0182] It should be noted that the description of the device embodiment of the present application is similar to the description of the method embodiment described above, and has similar beneficial effects as the method embodiment, so it will not be repeated. For technical details not disclosed in the device embodiment, please refer to the description of the method embodiment of the present application for understanding.
[0183] The embodiment of the present application provides a computer-readable storage medium in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the motion control method provided by the embodiment of the present application, for example, Figure 3 The motion control method is shown.
[0184] An embodiment of the present application provides a computer program product including computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the motion control method described in the embodiment of the present application.
[0185] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0186] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0187] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0188] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0189] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A motion control method, characterized in that: The method comprises: Acquire multiple control points of a virtual moving object; generating an initial curved trajectory of the virtual moving object based on the plurality of control points; In response to the change of the end point among the multiple control points when controlling the virtual motion object to move along the initial curve trajectory, the current position point, updated end point and target control point of the virtual motion object are obtained; the target control point is located on the tangent of the initial curve trajectory at the current position point; the multiple control points include at least a third control point, and the third control point is the end point; wherein, obtaining the target control point of the virtual motion object includes: obtaining a target first continuous point and a target second continuous point corresponding to the current position point; a fourth line between the target first continuous point and the target second continuous point overlaps with the tangent of the initial curve trajectory at the current position point; determining the distance value between the target second continuous point and the third control point; in response to the distance value being greater than a preset distance threshold, determining the target second continuous point as the target control point; in response to the distance value being less than or equal to the preset distance threshold, determining the target control point on the extension line of the fourth line; the direction of the extension line is from the target first continuous point to the target second continuous point; generating an updated curve trajectory of the virtual moving object based on the current position point, the updated end point and the target control point; The virtual moving object is controlled to move along the updated curve trajectory starting from the current position point.
2. The method according to claim 1, characterized in that The plurality of control points at least include: a first control point and a second control point; and generating an initial curved trajectory of the virtual moving object based on the plurality of control points includes: Determining, on a first connecting line between the first control point and the second control point, a plurality of first continuous points moving from the first control point to the second control point according to preset parameters; Determining, on a second line connecting the second control point and the third control point, a plurality of second continuous points moving from the second control point to the third control point according to preset parameters; wherein each first continuous point corresponds to one second continuous point; For each of the first continuous points, determining a third continuous point moving from the first continuous point to the second continuous point on a third line between the first continuous point and the corresponding second continuous point according to preset parameters, thereby obtaining a plurality of third continuous points; The first control point, the plurality of third continuous points, and the third control point are sequentially connected to obtain the initial curve trajectory.
3. The method according to claim 1, characterized in that The step of generating an updated curve trajectory of the virtual moving object based on the current position point, the updated end point, and the target control point includes: Determining, on a fifth line between the current position point and the target control point, a plurality of fourth consecutive points moving from the current position point to the target control point according to preset parameters; Determining, on a sixth line between the target control point and the updated end point, a plurality of fifth consecutive points moving from the target control point to the updated end point according to the preset parameters; wherein each fourth consecutive point corresponds to a fifth consecutive point; For each of the fourth continuous points, on a seventh line between the fourth continuous point and the corresponding fifth continuous point, determining a sixth continuous point moving from the fourth continuous point to the fifth continuous point according to the preset parameters, to obtain a plurality of sixth continuous points; The current position point, the plurality of sixth continuous points and the updated end point are sequentially connected to obtain the updated curve trajectory.
4. The method according to claim 1, wherein In response to controlling the virtual moving object to move along the initial curved trajectory, an end point among the plurality of control points changes, and obtaining a current position point, an updated end point, and a target control point of the virtual moving object includes: In response to controlling the virtual moving object to move along the initial curved trajectory, obtaining a moving speed of a tracking object of the virtual moving object; determining, based on the movement speed, a time interval for updating the curved trajectory of the virtual moving object; At each time interval, the current position point of the virtual moving object, the current tracking position point of the tracking object, and the target control point are obtained; wherein the tracking position point is the updated end point.
5. The method according to claim 1, characterized in that The step of obtaining a plurality of control points of the virtual moving object includes: In response to receiving a tracking operation for a tracking object, obtaining a starting point of the virtual moving object and a current tracking position of the tracking object; Based on the preset curvature coefficient of the curve trajectory, multiple candidate control points are obtained; determining a plurality of intermediate control points from the plurality of candidate control points based on the starting point of the virtual moving object, the tracking position point, and environmental parameters of the virtual environment in which the virtual moving object is located; The starting point of the virtual moving object, the multiple intermediate control points and the tracking position point are determined as the multiple control points.
6. The method according to any one of claims 1 to 5, characterized in that Obtaining the updated end point of the virtual moving object includes: In response to the virtual moving object being controlled to move along the initial curved trajectory, a current tracking object corresponding to the initial curved trajectory disappears, and a new tracking object is determined; The current location of the new tracking object is determined as the updated end point.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: In response to controlling the virtual moving object to move along the initial curved trajectory, the current tracking object corresponding to the initial curved trajectory disappears, and the movement of the virtual moving object along the initial curved trajectory is stopped.
8. A motion control device, characterized in that: include: A first acquisition module is used to acquire multiple control points of the virtual moving object; A first generating module, configured to generate an initial curved trajectory of the virtual moving object based on the plurality of control points; a second acquisition module, configured to acquire a current position point, an updated end point, and a target control point of the virtual moving object in response to a change in an end point among the plurality of control points when the virtual moving object is controlled to move along the initial curved trajectory; The target control point is located on the tangent line of the initial curve trajectory at the current position point; The multiple control points include at least a third control point, which is the termination point; wherein obtaining the target control point of the virtual moving object includes: obtaining a target first continuous point and a target second continuous point corresponding to the current position point; a fourth connecting line between the target first continuous point and the target second continuous point overlaps with a tangent of the initial curve trajectory at the current position point; determining a distance value between the target second continuous point and the third control point; in response to the distance value being greater than a preset distance threshold, determining the target second continuous point as the target control point; in response to the distance value being less than or equal to the preset distance threshold, determining the target control point on an extension line of the fourth connecting line; the direction of the extension line is from the target first continuous point to the target second continuous point; A second generating module is configured to generate an updated curve trajectory of the virtual moving object based on the current position point, the updated end point and the target control point; The control module is used to control the virtual moving object to move along the updated curve trajectory starting from the current position point.
9. An electronic device, characterized in that: include: a memory for storing computer-executable instructions; The processor is configured to implement the motion control method according to any one of claims 1 to 7 when executing the computer executable instructions stored in the memory.
Citation Information
Patent Citations
Method and device for controlling interaction between virtual object and projectile and storage medium
CN109200582A
Movement control method and device of virtual object and terminal equipment
CN111773671A