CN112973126B - Control method and device for connecting interactive objects at two ends of rope and computer equipment - Google Patents

Control method and device for connecting interactive objects at two ends of rope and computer equipment Download PDF

Info

Publication number
CN112973126B
CN112973126B CN202110145003.4A CN202110145003A CN112973126B CN 112973126 B CN112973126 B CN 112973126B CN 202110145003 A CN202110145003 A CN 202110145003A CN 112973126 B CN112973126 B CN 112973126B
Authority
CN
China
Prior art keywords
rope
engine
component
assembly
suspended state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110145003.4A
Other languages
Chinese (zh)
Other versions
CN112973126A (en
Inventor
夏露辉
许秋子
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Realis Multimedia Technology Co Ltd
Original Assignee
Shenzhen Realis Multimedia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Realis Multimedia Technology Co Ltd filed Critical Shenzhen Realis Multimedia Technology Co Ltd
Priority to CN202110145003.4A priority Critical patent/CN112973126B/en
Publication of CN112973126A publication Critical patent/CN112973126A/en
Application granted granted Critical
Publication of CN112973126B publication Critical patent/CN112973126B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/57Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game
    • A63F13/577Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game using determination of contact between game characters or objects, e.g. to avoid collision between virtual racing cars
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/80Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game specially adapted for executing a specific type of game
    • A63F2300/8082Virtual reality

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Toys (AREA)
  • Output Control And Ontrol Of Special Type Engine (AREA)

Abstract

The invention relates to a control device, a computer device and a storage medium for connecting two ends of a rope in a UE4 engine with an interactive object, wherein the method comprises the following steps: creating a first object inherited to an interactable object in a UE4 engine, creating a first scene component in the first object, creating a rope component in the first scene component, generating a second object in a BeginPlay event of the first object, creating a second scene component and an arrow component in the second object, wherein the first position of the first object is subtracted by the rope length of the rope component to obtain a second position of the second object; and determining that the second object is in a suspended state and a grabbed state, and controlling the first object, the rope assembly, the second object and the arrow assembly according to the suspended state and the grabbed state, so that the use of the rope assembly can meet the simulation VR application development. The method can simulate the simulation effect that objects can be interacted at both ends of the rope assembly.

Description

Control method and device for connecting interactive objects at two ends of rope and computer equipment
Technical Field
The invention relates to the technical field of game engines, in particular to a control device, a computer device and a storage medium for connecting two ends of a rope in a UE4 engine with an interactive object.
Background
The UE4 engine is a 3A-level time game engine developed by Epic game company in America, has a strong rendering effect, adopts a physical material system, and is one of favorite engines of developers. The UE4 engine picture effect completely reaches the 3A game level, and the illumination and physical rendering effects are strong. The UE4 blueprint system enables game plans to edit codes, and various official plug-ins are complete, so that developers do not need to self-edit third-party plug-ins and worry about the problem of compatible interfaces. More importantly, for virtual reality gaming, the UE4 engine provides good support for the handle, VR controller.
In the application of the prior art in virtual reality, one end of a rope is basically fixed on an object, and the other end of the rope is bound on the object to be operated. However, in the daily simulated VR application and development, a power line appears, connectors are arranged at two ends of the power line, the connectors are required to be picked up for interaction, and when the connector at one end is picked up, the other end needs to be naturally expressed. According to the use setting of prior art to the rope subassembly, can't satisfy emulation VR application development.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a control device, a device, computer equipment and a storage medium for connecting an interactive object at two ends of a rope in a UE4 engine, so that the use of the rope assembly can meet the application development of simulation VR, and the simulation effect that the interactive object is arranged at two ends of the rope assembly can be simulated.
In order to solve at least one technical problem, an embodiment of the present invention provides a method for controlling an interactive object connected to two ends of a rope in a UE4 engine, where the method includes:
creating a first object inherited to an interactable object in a UE4 engine, creating a first scene component in the first object, creating a rope component in the first scene component, generating a second object in a BeginPlay event of the first object, creating a second scene component and an arrow component in the second object, wherein a first position of the first object is subtracted by a rope length of the rope component to obtain a second position of the second object;
when the second object is in a suspended state and the second object does not contact any object in the UE4 engine, acquiring the last position point and the penultimate position point of the rope assembly, determining a first vector according to the last position point and the penultimate position point, acquiring a rotation angle when the second object rotates, and controlling the direction of rotation of the second object to be the same as the direction of the first vector according to the rotation angle;
when the second object is in a suspended state and the second object contacts any object in a UE4 engine and the distance between the second object and the first object is smaller than the rope length of the rope assembly, determining the position of the tail end point of the rope assembly according to the second object, and when the distance between the second object and the first object is larger than or equal to the rope length of the rope assembly, returning to the state that the second object is in a suspended state and the second object does not contact any object in a UE4 engine;
when the second object is grabbed by a player, the end point of the rope assembly is connected to the second scene assembly, and when the distance between the second object and the first object is greater than or equal to the length of the rope assembly, the state that the second object is in a suspended state and the second object does not contact any object in an engine of the UE4 is returned.
In one embodiment, the generating the second object in the beginnplay event of the first object comprises:
and generating the second object by using a SpawnActorFromClass function of the UE4 engine in a BeginPlay event of the first object.
In one embodiment, after the second object is in a suspended state and the second object does not contact any object in the UE4 engine, the method further includes:
the AttachEnd attribute of the second scene assembly is set to False and the position at which the second object is disposed according to the second assembly is on the last node of the cable assembly.
In one embodiment, the acquiring a rotation angle when the second object rotates includes:
adding rotation to the second object by using AddActorWorldRotation function of the UE4 engine, and acquiring the rotation angle of the rotation by using RotatorfromAxisandAngle function of the UE4 engine.
In one embodiment, the obtaining the rotation angle of the rotation using the rotatorfromsaxisandalle function of the UE4 engine comprises:
and transmitting preset rotation axis parameters and rotation angle parameters into the RotatorfromAxisandAngle function to obtain the rotation angle.
In one embodiment, before determining the position of the tail end point of the rope assembly according to the second object, the method further comprises:
the endpoint of the tether component is connected to the second component, with the AttachEnd attribute of the second component set to true.
In one embodiment, after determining the position of the tail end point of the rope assembly according to the second object, the method further includes:
the arrow component is directed towards the projected point of the first object on the ground in the UE4 engine.
A control device for connecting an interactive object at two ends of a rope in a UE4 engine, the device comprising:
the system comprises a creating module, a first position determining module and a second position determining module, wherein the creating module is used for creating a first object inherited to an interactive object in a UE4 engine, creating a first scene component in the first object, creating a rope component in the first scene component, generating a second object in a BeginPlay event of the first object, creating a second scene component and an arrow component in the second object, and subtracting a rope length of the rope component from a first position of the first object to obtain a second position of the second object;
the first control module is used for acquiring the last position point and the last but one position point of the rope assembly when the second object is in a suspended state and the second object does not contact any object in the UE4 engine, determining a first vector according to the last position point and the last but one position point, acquiring a rotation angle when the second object rotates, and controlling the direction of the second object to be the same as the direction of the first vector according to the rotation angle;
the second control module is used for determining the position of the tail end point of the rope assembly according to the second object when the second object is in a suspended state and the second object contacts any object in the UE4 engine and the distance between the second object and the first object is less than the rope length of the rope assembly, and returning to a state that the second object is in a suspended state and the second object does not contact any object in the UE4 engine when the distance between the second object and the first object is greater than or equal to the rope length of the rope assembly;
and the third control module is used for connecting the end point of the rope assembly to the second scene assembly when the second object is grabbed by a player, and returning to the state that the second object is in a suspended state and the second object does not contact any object in the UE4 engine when the distance between the second object and the first object is greater than or equal to the length of the rope assembly.
In addition, an embodiment of the present invention further provides a computer device, including: the system comprises a memory, a processor and an application program stored on the memory and capable of running on the processor, wherein the processor realizes the steps of the method of any embodiment when executing the application program.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which an application program is stored, and when the application program is executed by a processor, the steps of any one of the above-mentioned embodiments of the method are implemented.
In the embodiment of the invention, by implementing the method, the first object, the second object, the rope assembly and the like are reset respectively for three cases, namely a first state that the second object is in a suspended state and is not in contact with any object in the UE4 engine, a second state that the second object is in a suspended state and is in contact with any object in the UE4 engine and the distance between the second object and the first object is less than the length of the rope assembly, and a third state that the second object is grabbed by a player, so that the rope assembly can show a natural simulation effect in various states, and the use of the rope assembly can meet the development of simulation VR application.
Drawings
FIG. 1 is a schematic flow chart illustrating control of an interactive object connected to two ends of a rope in a UE4 engine according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a control device in which two ends of a rope in a UE4 engine are connected to an interactive object in an embodiment of the present invention;
fig. 3 is a schematic structural composition diagram of a computer device in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a method for controlling two ends of a rope in a UE4 engine to be connected with an interactive object, and as shown in figure 1, the method for controlling two ends of the rope in the UE4 engine to be connected with the interactive object comprises the following steps:
s102, a first object inherited to an interactive object in a UE4 engine is created, a first scene component is created in the first object, a rope component is created in the first scene component, a second object is generated in a BeginPlay event of the first object, a second scene component and an arrow component are created in the second object, wherein the second position of the second object is obtained by subtracting the rope length of the rope component from the first position of the first object.
Preferably, generating the second object in a BeginPlay event of the first object includes: and generating the second object by using a SpawnActorFromClass function carried by the UE4 engine in a BeginPlay event of the first object.
In particular, a first object is created that inherits from the interactable object. Wherein the heel assembly of the interactive object is a static model, the handle contacts the assembly and presses the button of the pick-up function to pick up the interactive object. The first object is named BP _ header a. A first scene component, named CableSceneA, is created in BP _ header a. A cordage component Cable, named uncablea, is created under cablecenea. And creating a second object inherited from the interactive object and named as BP _ HeadB. Creating a second scene component in BP _ HeadB, named CableSeNEB; an arrow component is created in BP _ HeadB, named HeadBlirarrow, and the direction of the HeadBlirarrow is adjusted so that the direction pointed by the arrow is consistent with the direction of the normal vector connecting the component and CableA, and the direction is towards the side of CableA.
Specifically, in the BeginPlay event of BP _ header, a BP _ header is generated using the spawnactor fromclass function of the UE4 itself at a position of BP _ header minus the length CableLength of the CableA component.
And S104, when the second object is in a suspended state and the second object does not contact any object in the UE4 engine, acquiring the last position point and the penultimate position point of the rope assembly, determining a first vector according to the last position point and the penultimate position point, acquiring a rotation angle when the second object rotates, and controlling the direction of the rotation of the second object to be the same as the direction of the first vector according to the rotation angle.
Preferably, after the second object is in a suspended state and the second object does not contact any object in the UE4 engine, the method further includes: the AttachEnd attribute of the second scene assembly is set to False and the position at which the second object is disposed according to the second assembly is on the last node of the cable assembly.
Preferably, the acquiring a rotation angle at which the second object rotates includes: and adding rotation to the second object by using an addactorwoldrotation function of the UE4 engine, and acquiring the rotation angle of the rotation by using a rotarfrom AxisandAngle function of the UE4 engine.
Preferably, the obtaining the rotation angle of the rotation using the rotatorfromsaxisandalle function of the UE4 engine comprises: and transmitting preset rotating shaft parameters and rotating angle parameters into the RotatorfromAxisandAngle function to obtain the rotating angle.
Specifically, the state (1) is set to the state where the second object is in a suspended state and the second object is not in contact with any object in the UE4 engine.
State (1): BP _ HeadB is in a floating state. The AttachEnd attribute of CableSeneB in the floating state is set to False, cableSeneB leaves BP _ HeadB, and the position of BP _ HeadB is determined by CableSeneB. When the player grabs the BP _ HeadA with a hand, the rope assembly can hang freely, if the player does not contact the ground or other objects, the position of the BP _ HeadB should be on the last node of the CableA, and it needs to be ensured that the HeadBDirArrow of the BP _ HeadB always points to the cross section direction of the tail end of the CableA, and when the BP _ HeadA moves, the CableA and the BP _ HeadB can be driven to start, so that the effect that the BP _ HeadB is in a suspended state can be better.
Specifically, the world coordinates of the last and second last points of CableA of BP _ header a acquired by the getcableparticle locations function of CableA are stored and named as endenabled and secondedcenableaction, respectively, and the position of BP _ header b is set to endenabled, or an offset may be added according to the requirement to make the connected part smoother.
When BP _ HeadB moves, the rope assembly CableA follows, the direction of the cross section of the tail end of CableA is changed, and in order to enable BP _ HeadB and CableA to be connected well, the BP _ HeadB needs to be rotated to enable HeadBDArrow of the BP _ HeadB to be consistent with a vector formed by SecondEndcablealization-Endcablocatalysis. The method is that a rotation is added to BP _ HeadB by using an AddActorWorldRotation function carried by the UE4, and the rotation is obtained by using a RotatorfromAxisandAngle function carried by the UE4, wherein two parameters are required to be transmitted to the RotatorfromAxisandAngle function, two parameter bit rotating shafts and a rotating angle. The rotation axis can be obtained using the cross product of the vectors, and the rotation angle can be obtained using the point product of the vectors and the inverse trigonometric function.
Wherein, when the BP _ HeadB is in a floating state, if the BP _ HeadB is in contact with the ground or other objects and the distance from the BP _ HeadA is less than the length of the rope, the BP _ HeadB is switched to the state (2).
And S106, when the second object is in a suspended state and contacts any object in the UE4 engine, and the distance between the second object and the first object is smaller than the rope length of the rope assembly, determining the position of the tail end point of the rope assembly according to the second object, and when the distance between the second object and the first object is larger than or equal to the rope length of the rope assembly, returning to the state that the second object is in a suspended state and the second object does not contact any object in the UE4 engine.
Preferably, before determining the position of the tail end point of the rope assembly according to the second object, the method further comprises: the endpoint of the tether component is connected to the second component, with the AttachEnd attribute of the second component set to true.
Preferably, after determining the position of the tail end point of the rope assembly according to the second object, the method further comprises: the arrow component is directed towards the first object's projected point on the ground in the UE4 engine.
Specifically, the state (2) is set in which the second object is in a suspended state and the second object contacts any object in the UE4 engine, and the distance between the second object and the first object is smaller than the rope length of the rope assembly.
State (2): the BP _ header b is dropped on the ground or other static model surface.
After the BP _ header b is switched to this state, the endpoint Attach of CableA is fixed to the cablescenenb of BP _ header b, the AttachEnd attribute is set to true, and the BP _ header b determines the position of the tail endpoint of CableA. In order to make the effect real, the rotation is carried out in the horizontal direction, and the HeadBlirarrow is ensured to always face to the projection point of BP _ HeadA on the ground, the same algorithm in the state (1) is adopted. When the distance between BP _ HeadB and BP _ HeadA is larger than the length of the rope, the state is switched to the state (1).
And S108, when the second object is grabbed by a player, connecting the end point of the rope assembly to the second scene assembly, and when the distance between the second object and the first object is greater than or equal to the length of the rope assembly, returning to the state that the second object is in a suspended state and the second object does not contact any object in the engine of the UE 4.
Grabbing the second object by the player to set to state (3).
State (3): BP _ HeadB is held by the player.
After the BP _ HeadB is switched to the state, the BP _ HeadB is fixed on the handle of the player, at the moment, the endpoint Attach of the CableA is also enabled to be connected to the CableSenneB of the BP _ HeadB, and when the distance between the BP _ HeadB and the BP _ HeadA is larger than the length of the rope, the state is switched to the state (1).
By implementing the method, the first object, the second object, the rope assembly and the like are reset respectively for the three conditions of the first state that the second object is in a suspended state and the second object is not in contact with any object in the UE4 engine, the second state that the second object is in a suspended state and the second object is in contact with any object in the UE4 engine and the distance between the second object and the first object is less than the length of the rope assembly, and the third state that the second object is grabbed by a player, so that the rope assembly can show natural simulation effect in various states, and the use of the rope assembly can meet the development of simulation VR application.
In one embodiment, the invention also provides a control device for connecting the two ends of the rope in the UE4 engine with the interactive object. As shown in fig. 2, the apparatus includes:
a creating module 12, configured to create a first object inherited to an interactable object in an engine of the UE4, create a first scene component in the first object, create a rope component in the first scene component, generate a second object in a beginnplay event of the first object, create a second scene component and an arrow component in the second object, wherein a second position of the second object is obtained by subtracting a rope length of the rope component from a first position of the first object;
a first control module 14, configured to, when the second object is in a suspended state and the second object does not contact any object in the UE4 engine, obtain a last position point and a second last position point of the rope assembly, determine a first vector according to the last position point and the second last position point, obtain a rotation angle when the second object rotates, and control a direction in which the second object rotates to be the same as a direction of the first vector according to the rotation angle;
the second control module 16 is configured to determine the position of the tail end point of the rope assembly according to the second object when the second object is in a suspended state and the second object contacts any object in the UE4 engine and the distance between the second object and the first object is less than the rope length of the rope assembly, and return to a state where the second object is in a suspended state and the second object does not contact any object in the UE4 engine when the distance between the second object and the first object is greater than or equal to the rope length of the rope assembly;
and the third control module 18 is used for connecting the end point of the rope assembly to the second scene assembly when the second object is grabbed by the player, and returning to the state that the second object is in a suspended state and the second object does not contact any object in the engine of the UE4 when the distance between the second object and the first object is greater than or equal to the length of the rope assembly.
For specific limitations of a control device for connecting an interactive object to two ends of a rope in a UE4 engine, reference may be made to the above limitations of a control method for connecting an interactive object to two ends of a rope in a UE4 engine, and details are not repeated here. The above-mentioned control device for connecting the two ends of the rope to the interactive object in the UE4 engine may be implemented wholly or partially by software, hardware, or a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In a computer-readable storage medium provided in an embodiment of the present invention, an application program is stored in the computer-readable storage medium, and when the application program is executed by a processor, the application program implements a method for controlling an interactive object connected to two ends of a rope in a UE4 engine according to any one of the embodiments. The computer-readable storage medium includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random AcceSS memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage device includes any medium that stores or transmits information in a form readable by a device (e.g., a computer, a cellular phone), and may be a read-only memory, a magnetic or optical disk, or the like.
The embodiment of the present invention further provides a computer application program, which runs on a computer, and the computer application program is configured to execute a method for controlling an interactive object connected to two ends of a rope in a UE4 engine according to any one of the above embodiments.
Fig. 3 is a schematic structural diagram of a computer device in the embodiment of the present invention.
An embodiment of the present invention further provides a computer device, as shown in fig. 3. The computer apparatus includes a processor 302, a memory 303, an input unit 304, a display unit 305, and the like. Those skilled in the art will appreciate that the device configuration means shown in fig. 3 do not constitute a limitation of all devices and may include more or less components than those shown, or some components in combination. The memory 303 may be used to store the application 301 and various functional modules, and the processor 302 executes the application 301 stored in the memory 303, thereby performing various functional applications of the device and data processing. The memory may be internal or external memory, or include both internal and external memory. The internal memory may include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), flash memory, or random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a usb disk, a magnetic tape, etc. The disclosed memory includes, but is not limited to, these types of memory. The disclosed memory is by way of example only and not by way of limitation.
The input unit 304 is used for receiving input of signals and keywords input by a user. The input unit 304 may include a touch panel and other input devices. The touch panel can collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel by using any suitable object or accessory such as a finger, a stylus and the like) and drive the corresponding connecting device according to a preset program; other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., play control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like. The display unit 305 may be used to display information input by a user or information provided to the user and various menus of the terminal device. The display unit 305 may take the form of a liquid crystal display, an organic light emitting diode, or the like. The processor 302 is a control center of the terminal device, connects various parts of the entire device using various interfaces and lines, performs various functions and processes data by operating or executing software programs and/or modules stored in the memory 303, and calling data stored in the memory.
As one embodiment, the computer device includes: one or more processors 302, a memory 303, and one or more applications 301, wherein the one or more applications 301 are stored in the memory 303 and configured to be executed by the one or more processors 302, and the one or more applications 301 are configured to perform a method for controlling a tether connection of an interactable object in a UE4 engine in any of the above embodiments.
In addition, the above detailed description is provided for the control method, apparatus, computer device and storage medium for connecting interactive objects at two ends of a rope in a UE4 engine according to the embodiments of the present invention, and a specific example should be used herein to explain the principle and the implementation manner of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (8)

1. A control method for connecting an interactive object at two ends of a rope in a UE4 engine is characterized by comprising the following steps:
creating a first object inherited to an interactable object in a UE4 engine, creating a first scene component in the first object, creating a rope component in the first scene component, generating a second object in a BeginPlay event of the first object, creating a second scene component and an arrow component in the second object, wherein a first position of the first object is subtracted by a rope length of the rope component to obtain a second position of the second object;
when the second object is in a suspended state and the second object does not contact any object in the UE4 engine, acquiring the last position point and the penultimate position point of the rope assembly, determining a first vector according to the last position point and the penultimate position point, acquiring a rotation angle when the second object rotates, and controlling the direction of rotation of the second object to be the same as the direction of the first vector according to the rotation angle;
when the second object is in a suspended state and the second object contacts any object in a UE4 engine and the distance between the second object and the first object is smaller than the rope length of the rope assembly, determining the position of the tail end point of the rope assembly according to the second object, and when the distance between the second object and the first object is larger than or equal to the rope length of the rope assembly, returning to the state that the second object is in a suspended state and the second object does not contact any object in a UE4 engine;
when the second object is grabbed by a player, connecting an end point of the rope assembly to the second scene assembly, and when the distance between the second object and the first object is greater than or equal to the rope length of the rope assembly, returning to a state that the second object is in a suspended state and the second object does not contact any object in a UE4 engine;
wherein the acquiring a rotation angle at which the second object rotates includes:
adding rotation to the second object by using an addactorwoldrotation function carried by the UE4 engine, and acquiring the rotation angle of the rotation by using a rotarfrom axisanlength function carried by the UE4 engine;
wherein the obtaining the rotation angle of the rotation using a RotatorfromAxisandAngle function of the UE4 engine comprises:
and transmitting preset rotating shaft parameters and rotating angle parameters into the RotatorfromAxisandAngle function to obtain the rotating angle.
2. The method of claim 1, wherein generating a second object in a beginnplay event of the first object comprises:
and generating the second object by using a SpawnActorFromClass function carried by the UE4 engine in a BeginPlay event of the first object.
3. The method of claim 1, wherein after the second object is in a suspended state and the second object does not contact any object in the UE4 engine, the method further comprises:
the AttachEnd attribute of the second scene assembly is set to False, and the position of the second object is set on the last node of the rope assembly according to the second assembly.
4. The method of claim 1, wherein prior to determining the position of the tail termination point of the tether assembly from the second object, further comprising:
the endpoint of the tether component is connected to the second component, and the AttachEnd attribute of the second component is set to true.
5. The method of claim 1, wherein after determining the position of the tail termination point of the tether assembly from the second object, further comprising:
the arrow component is directed towards the first object's projected point on the ground in the UE4 engine.
6. A control device for connecting an interactive object at two ends of a rope in a UE4 engine, which is characterized by comprising:
a creating module, configured to create a first object inherited to an interactable object in a UE4 engine, create a first scene component in the first object, create a rope component in the first scene component, generate a second object in a beginnplay event of the first object, create a second scene component and an arrow component in the second object, wherein a second position of the second object is obtained by subtracting a rope length of the rope component from a first position of the first object;
the first control module is used for acquiring the last position point and the last but one position point of the rope assembly when the second object is in a suspended state and the second object does not contact any object in the UE4 engine, determining a first vector according to the last position point and the last but one position point, acquiring a rotation angle when the second object rotates, and controlling the direction of the second object to be the same as the direction of the first vector according to the rotation angle;
the second control module is used for determining the position of a tail end point of the rope assembly according to the second object when the second object is in a suspended state and the second object is in contact with any object in a UE4 engine and the distance between the second object and the first object is less than the length of the rope assembly, and returning to a state that the second object is in a suspended state and the second object is not in contact with any object in the UE4 engine when the distance between the second object and the first object is greater than or equal to the length of the rope assembly;
the third control module is used for connecting the end point of the rope assembly to the second scene assembly when the second object is grabbed by a player, and returning to the state that the second object is in a suspended state and the second object is not contacted with any object in the UE4 engine when the distance between the second object and the first object is greater than or equal to the length of the rope assembly;
wherein the acquiring of the rotation angle at which the second object rotates includes:
adding rotation to the second object by using an addactorwoldrotation function carried by the UE4 engine, and acquiring the rotation angle of the rotation by using a rotarfrom axisanlength function carried by the UE4 engine;
wherein the obtaining the rotation angle of the rotation using a RotatorfromAxisandAngle function onboard the UE4 engine comprises:
and transmitting preset rotating shaft parameters and rotating angle parameters into the RotatorfromAxisandAngle function to obtain the rotating angle.
7. A computer device comprising a memory, a processor and an application program stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1 to 5 when executing the application program.
8. A computer-readable storage medium on which an application program is stored, wherein the application program, when executed by a processor, performs the steps of the method of any one of claims 1 to 5.
CN202110145003.4A 2021-02-02 2021-02-02 Control method and device for connecting interactive objects at two ends of rope and computer equipment Active CN112973126B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110145003.4A CN112973126B (en) 2021-02-02 2021-02-02 Control method and device for connecting interactive objects at two ends of rope and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110145003.4A CN112973126B (en) 2021-02-02 2021-02-02 Control method and device for connecting interactive objects at two ends of rope and computer equipment

Publications (2)

Publication Number Publication Date
CN112973126A CN112973126A (en) 2021-06-18
CN112973126B true CN112973126B (en) 2022-11-29

Family

ID=76346730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110145003.4A Active CN112973126B (en) 2021-02-02 2021-02-02 Control method and device for connecting interactive objects at two ends of rope and computer equipment

Country Status (1)

Country Link
CN (1) CN112973126B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102495752A (en) * 2011-12-05 2012-06-13 山东大学 Flexible rope simulation method
CN102810209A (en) * 2011-12-14 2012-12-05 成都运达科技股份有限公司 Method for simulating work of crane cable based on game engine
CN107661629A (en) * 2017-10-26 2018-02-06 广州市雷军游乐设备有限公司 A kind of pull rope weave control method, apparatus, terminal device and storage medium
CN107789828A (en) * 2017-10-26 2018-03-13 广州市雷军游乐设备有限公司 Decorate cord-like state method of adjustment, device, terminal device and storage medium
CN110895831A (en) * 2019-11-13 2020-03-20 北京英贝思科技有限公司 Method for hoisting virtual reality products based on Unity3d development equipment
CN111667558A (en) * 2020-06-11 2020-09-15 深圳市瑞立视多媒体科技有限公司 Rope connection optimization method based on unreal engine and related equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10864434B2 (en) * 2018-02-27 2020-12-15 Square Enix Ltd. Simulation of multiple connected bodies for real-time application
US11068626B2 (en) * 2018-10-04 2021-07-20 Nvidia Corporation Simulating a cable driven system by simulating the effect of cable portions on objects of the system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102495752A (en) * 2011-12-05 2012-06-13 山东大学 Flexible rope simulation method
CN102810209A (en) * 2011-12-14 2012-12-05 成都运达科技股份有限公司 Method for simulating work of crane cable based on game engine
CN107661629A (en) * 2017-10-26 2018-02-06 广州市雷军游乐设备有限公司 A kind of pull rope weave control method, apparatus, terminal device and storage medium
CN107789828A (en) * 2017-10-26 2018-03-13 广州市雷军游乐设备有限公司 Decorate cord-like state method of adjustment, device, terminal device and storage medium
CN110895831A (en) * 2019-11-13 2020-03-20 北京英贝思科技有限公司 Method for hoisting virtual reality products based on Unity3d development equipment
CN111667558A (en) * 2020-06-11 2020-09-15 深圳市瑞立视多媒体科技有限公司 Rope connection optimization method based on unreal engine and related equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"UE4 C++ 娃娃机物理版(鬼畜物理)";Melody;《知乎网站》;20201207;网址:https://zhuanlan.zhihu.com/p/333378123 *
基于物理引擎的多体***实时运动仿真研究;陈刚等;《***仿真学报》;20130725;173-178 *

Also Published As

Publication number Publication date
CN112973126A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN109544663B (en) Virtual scene recognition and interaction key position matching method and device of application program
JP2021517002A (en) Virtual resource processing methods and devices in the game scene
JP2022526134A (en) Virtual object control method, device, terminal and storage medium
CN109189302B (en) Control method and device of AR virtual model
WO2023273131A1 (en) Game scene generation method and apparatus, storage medium, and electronic apparatus
CN115690375B (en) Building model modification interaction method, system and terminal based on virtual reality technology
US20230405452A1 (en) Method for controlling game display, non-transitory computer-readable storage medium and electronic device
CN113350779A (en) Game virtual character action control method and device, storage medium and electronic equipment
CN115409680A (en) Rendering method, device and system
CN115082608A (en) Virtual character clothing rendering method and device, electronic equipment and storage medium
CN112973126B (en) Control method and device for connecting interactive objects at two ends of rope and computer equipment
CN113672387A (en) Remote calling graphics rendering method and system based on drawing programming interface
WO2024045584A1 (en) Data processing method and apparatus based on cloud game, and electronic device and storage medium
US20230241513A1 (en) Game cheat detection from mouse lifting
CN116212374A (en) Model processing method, device, computer equipment and storage medium
CN112435318B (en) Anti-threading method and device in game, electronic equipment and storage medium
CN112451967A (en) Game interaction method and device based on 3D screen interaction and computer equipment
CN116510287A (en) Game control method, game control device, electronic equipment and storage medium
CN112206525A (en) Information processing method and device for hand-twisting virtual article in UE4 engine
CN112435317A (en) Anti-threading method and device in game, electronic equipment and storage medium
CN112206524B (en) Information processing method and device for picking up virtual article in UE4 engine
CN113701563B (en) Method and device for real-time automatic target aiming of tank in UE4
CN110930488A (en) Fish body behavior simulation method, device, equipment and storage medium
CN113590334B (en) Method, device, medium and electronic equipment for processing character model
CN115999155A (en) Buoyancy expression method, device and storage medium of virtual floating object model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant