CN109887103B - Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium - Google Patents

Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium Download PDF

Info

Publication number
CN109887103B
CN109887103B CN201910218378.1A CN201910218378A CN109887103B CN 109887103 B CN109887103 B CN 109887103B CN 201910218378 A CN201910218378 A CN 201910218378A CN 109887103 B CN109887103 B CN 109887103B
Authority
CN
China
Prior art keywords
unity3d
earth model
preset body
clone
preset
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
CN201910218378.1A
Other languages
Chinese (zh)
Other versions
CN109887103A (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.)
Vtron Group Co Ltd
Original Assignee
Vtron Group 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 Vtron Group Co Ltd filed Critical Vtron Group Co Ltd
Priority to CN201910218378.1A priority Critical patent/CN109887103B/en
Publication of CN109887103A publication Critical patent/CN109887103A/en
Application granted granted Critical
Publication of CN109887103B publication Critical patent/CN109887103B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The application discloses a Unity3D positioning stationing method, a device, equipment and a computer readable storage medium, by constructing a preset body including a parent object and a child object in Unity3D, converting the latitude and longitude data of the target positioning object model into rotational coordinate data in a spatial coordinate system, instantiating the preset body, assigning the rotating coordinate data and the position data of the earth model in the Unity3D to the instantiated preset body, realizing the purpose of fixing the sub-object of the preset body to the position of the target point consistent with the longitude and latitude data, finally adding the target fixed point object model on the sub-object, the automatic point distribution method provided by the application does not need manual point distribution, reduces labor cost, improves accuracy and efficiency of positioning point distribution, and solves the technical problems of high labor cost, low efficiency and high error rate of the conventional manual point distribution.

Description

Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium
Technical Field
The application relates to the technical field of 3D positioning, in particular to a Unity3D positioning and point distributing method, device and equipment.
Background
Unity3D is a comprehensive game development tool developed by Unity Technologies that allows players to easily create multiple platforms of types of interactive content, such as three-dimensional video games, building visualizations, real-time three-dimensional animations, etc., and is a fully integrated professional game engine.
At present, a building or other objects are generated at a certain fixed point on the earth in Unity3D, the method is to find a position needing the fixed point in Unity3D through manual stationing, and then place a model of the corresponding building or object at the position to complete the fixed point operation of the building or object.
Disclosure of Invention
The embodiment of the application provides a Unity3D positioning stationing method, device, equipment and computer readable storage medium, which are used for solving the technical problems of high labor cost, low efficiency and high error rate of the existing manual stationing.
In view of the above, the first aspect of the present application provides a Unity3D location stationing method, including the following steps:
101. constructing a preset body with the distance between a child object and a parent object equal to the radius of the earth model in Unity3D, wherein the parent object is located at the position of the sphere center of the earth model;
102. acquiring longitude and latitude data of a target fixed point object model, and converting the longitude and latitude data into rotation coordinate data under a space coordinate system;
103. instantiating the preset body to obtain a clone preset body, and assigning the position of the earth model and the rotating coordinate data to the clone preset body;
104. and adding the target fixed point object model on the child object of the clone presetting body.
Preferably, before step 101, the method further comprises:
100. the earth model is generated in Unity 3D.
Preferably, the spatial coordinate system is:
and a Cartesian left-hand coordinate system is constructed by taking the sphere center of the earth model as the origin of coordinates and the equatorial plane of the earth model as an x axis.
Preferably, step 103 specifically includes:
1031. instantiating the preset body to obtain a clone preset body;
1032. rotating the parent object of the cloning preset body according to the rotating coordinate data to enable the child object of the cloning preset body to rotate to the coordinate position corresponding to the rotating coordinate data;
1033. assigning the location of the earth model to the clonal presets such that children of the clonal presets are located on the earth model.
The second aspect of the present application also provides a Unity3D positioning and stationing device, comprising:
the building unit is used for building a preset body with the distance between a child object and a parent object equal to the radius of the earth model in Unity3D, wherein the parent object is positioned at the center of the earth model;
the conversion unit is used for acquiring longitude and latitude data of the target fixed point object model and converting the longitude and latitude data into rotation coordinate data under a space coordinate system;
the instantiation unit is used for instantiating the preset body to obtain a clone preset body and assigning the position of the earth model and the rotating coordinate data to the clone preset body;
and the generating unit is used for adding the target fixed point object model on the child object of the clone presetting body.
Preferably, the method further comprises the following steps:
a preprocessing unit for generating an earth model in Unity 3D;
the spatial coordinate system is as follows:
and a Cartesian left-hand coordinate system is constructed by taking the sphere center of the earth model as the origin of coordinates and the equatorial plane of the earth model as an x axis.
Preferably, the instantiation unit specifically includes:
a clone subunit, configured to instantiate the preset body to obtain a clone preset body;
a rotation subunit, configured to rotate the parent object of the preset cloning object according to the rotation coordinate data, so that the child object of the preset cloning object rotates to a coordinate position corresponding to the rotation coordinate data;
and the fixed point subunit is used for assigning the position of the earth model to the clone presetting body so as to enable the sub-object of the clone presetting body to be fixed on the earth model.
The third aspect of the present application also provides a Unity3D location pointing device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the Unity3D localization and placement method according to the instructions in the program code.
The fourth aspect of the present application also provides a computer-readable storage medium for storing program code for executing the Unity3D location stationing method of the first aspect.
The fifth aspect of the present application also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the Unity3D location stationing method of the first aspect.
According to the technical scheme, the embodiment of the application has the following advantages:
in this application, a Unity3D positioning and point-distributing method is provided, including: 101. constructing a preset body with the distance between a child object and a parent object equal to the radius of the earth model in Unity3D, wherein the parent object is positioned at the center of the earth model; 102. acquiring longitude and latitude data of a target fixed point object model, and converting the longitude and latitude data into rotation coordinate data under a space coordinate system; 103. instantiating a preset body to obtain a clone preset body, and assigning the position and rotation coordinate data of the earth model to the clone preset body; 104. and adding the target fixed point object model on the child object of the clone preset body. According to the Unity3D positioning and point arranging method, the preset body comprising the parent object and the child object is built in the Unity3D, longitude and latitude data of the target positioning object model are converted into rotating coordinate data under a space coordinate system, the preset body is instantiated, the rotating coordinate data and position data of the earth model in the Unity3D are assigned to the instantiated preset body, so that the child object of the preset body is fixed to the target point position consistent with the longitude and latitude data, and finally the target fixed point object model is added on the child object, namely the positioning and point arranging of the target fixed point object model is completed.
Drawings
FIG. 1 is a schematic flow chart diagram illustrating one embodiment of a Unity3D location stationing method provided herein;
FIG. 2 is a schematic flow chart diagram illustrating another embodiment of a Unity3D location stationing method provided herein;
fig. 3 is a schematic structural diagram of an embodiment of a Unity3D location stationing device provided in the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
For easy understanding, please refer to fig. 1, an embodiment of a Unity3D location dotting method provided by the present application includes:
step 101, constructing a preset body with the distance between the child object and the parent object equal to the radius of the earth model in Unity3D, wherein the parent object is located at the center of the earth model.
It should be noted that, in the embodiment of the present application, a preset body is first constructed in Unity3D, where the preset body includes a parent object and a child object, the parent object and the child object may be objects without specific forms, the parent object is disposed at the spherical center position of the earth model in Unity3D, and the distance between the child object and the parent object is equal to the radius of the earth model, so that the child object is exactly on the spherical surface of the earth model.
And 102, acquiring longitude and latitude data of the target fixed point object model, and converting the longitude and latitude data into rotation coordinate data under a space coordinate system.
It should be noted that, in this embodiment of the application, longitude and latitude data of the target fixed point object model, that is, longitude and latitude data corresponding to a building to be fixed at a target point, may be obtained from a data source, and the longitude and latitude data is converted into rotation coordinate data in a spatial coordinate system through a preset algorithm, for example, the longitude and latitude data of the target fixed point object model is (east longitude 0 degree, north latitude 0 degree), and the corresponding rotation coordinate is (earth radius of x-axis in the spatial coordinate system, 0, 0).
Step 103, instantiating the preset body to obtain a clone preset body, and assigning the position and rotation coordinate data of the earth model to the clone preset body.
It should be noted that, in the embodiment of the present application, a preset body needs to be instantiated to obtain an instantiated clone preset body, and then the rotational coordinate data obtained in step 102 and the position data of the earth model in Unity3D are assigned to the instantiated clone preset body, so that a sub-object of the instantiated clone preset body can be fixed at a position on the earth model corresponding to the longitude and latitude data of the target.
And 104, adding a target fixed point object model on the child object of the clone preset body.
It should be noted that, after step 103 is completed, the target fixed point model is added to the child object of the instantiated clone preset entity, so that the positioning and stationing operation of the target fixed point object model is completed, and the effect of positioning and stationing the target fixed point object model on the earth model is achieved.
The Unity3D positioning and point arranging method provided by the application comprises the following steps: 101. constructing a preset body with the distance between a child object and a parent object equal to the radius of the earth model in Unity3D, wherein the parent object is positioned at the center of the earth model; 102. acquiring longitude and latitude data of a target fixed point object model, and converting the longitude and latitude data into rotation coordinate data under a space coordinate system; 103. instantiating a preset body to obtain a clone preset body, and assigning the position and rotation coordinate data of the earth model to the clone preset body; 104. and adding the target fixed point object model on the child object of the clone preset body. According to the Unity3D positioning and point arranging method, the preset body comprising the parent object and the child object is built in the Unity3D, longitude and latitude data of the target positioning object model are converted into rotating coordinate data under a space coordinate system, the preset body is instantiated, the rotating coordinate data and position data of the earth model in the Unity3D are assigned to the instantiated preset body, so that the child object of the preset body is fixed to the target point position consistent with the longitude and latitude data, and finally the target fixed point object model is added on the child object, namely the positioning and point arranging of the target fixed point object model is completed.
For easy understanding, referring to fig. 2, on the basis of the previous embodiment, another embodiment of a Unity3D location stationing method is further provided in the embodiment of the present application, including:
at step 201, an earth model is generated at Unity 3D.
In the embodiment of the present application, the earth model is first generated in Unity3D, and may be directly introduced into an earth model or sphere, or may be newly constructed.
Step 202, constructing a preset body with the distance between the child object and the parent object equal to the radius of the earth model in Unity3D, wherein the parent object is located at the center of the earth model.
It should be noted that, in the embodiment of the present application, step 202 is the same as step 101 in the previous embodiment, and details are not described herein again.
And 203, acquiring longitude and latitude data of the target fixed point object model, and converting the longitude and latitude data into rotation coordinate data under a space coordinate system.
It should be noted that step 203 in the present embodiment is the same as step 102 in the previous embodiment, and detailed description thereof is omitted here.
Further, the spatial coordinate system is:
and a Cartesian left-hand coordinate system is constructed by taking the sphere center of the earth model as the origin of coordinates and the equatorial plane of the earth model as the x axis.
Step 204, instantiating the preset body to obtain the clone preset body.
It should be noted that, in the embodiment of the present application, a preset entity needs to be instantiated to obtain a clone preset entity consistent with the preset entity.
And step 205, rotating the parent object of the cloning preset body according to the rotating coordinate data, so that the child object of the cloning preset body rotates to the coordinate position corresponding to the rotating coordinate data.
It should be noted that, the parent object of the cloning preset body is controlled to rotate (rotate) by a corresponding angle direction according to the obtained rotation coordinate data, and then the child object correspondingly rotates by a corresponding angle and direction around the surface of the earth model, so that the child object of the cloning preset body rotates to a coordinate position corresponding to the rotation coordinate data.
And step 206, assigning the position of the earth model to the cloning preset body so that the child object of the cloning preset body is fixed on the earth model.
It should be noted that, in the embodiment of the present application, after the sub-object of the clone preset volume is rotated to the coordinate position corresponding to the rotated coordinate data, the position of the earth model in Unity3D is assigned to the clone preset volume, so that the sub-object of the clone preset volume is fixed on the earth model, and the positioning operation of the sub-object of the clone preset volume is completed.
And step 207, adding a target fixed point model on the child object of the clone preset body.
It should be noted that step 207 in the present embodiment is the same as step 104 in the previous embodiment, and detailed description thereof is omitted here.
For easy understanding, please refer to fig. 3, an embodiment of the present application further provides a Unity3D positioning and stationing apparatus, including:
the building unit 301 is configured to build a preset body with a distance between a child object and a parent object equal to the radius of the earth model in Unity3D, where the parent object is located at the center of the earth model.
The conversion unit 302 is configured to obtain longitude and latitude data of the target fixed-point object model, and convert the longitude and latitude data into rotation coordinate data in a spatial coordinate system.
And the instantiation unit 303 is configured to instantiate the preset body to obtain a clone preset body, and assign the position and rotation coordinate data of the earth model to the clone preset body.
A generating unit 304, configured to add the target fixed-point object model to the child objects of the clone preset.
Further, still include:
a preprocessing unit 300 for generating an earth model in Unity 3D.
Further, the spatial coordinate system is:
and a Cartesian left-hand coordinate system is constructed by taking the sphere center of the earth model as the origin of coordinates and the equatorial plane of the earth model as the x axis.
Further, the instantiation unit 303 specifically includes:
and a clone subunit 3031, configured to instantiate the preset body, so as to obtain a clone preset body.
A rotation subunit 3032, configured to rotate the parent object of the clone preset volume according to the rotation coordinate data, so that the child object of the clone preset volume rotates to the coordinate position corresponding to the rotation coordinate data.
A pointing subunit 3033, configured to assign the location of the earth model to the clonal presets such that children of the clonal presets are pointed on the earth model.
The embodiment of the application also provides a Unity3D positioning and stationing device, which comprises a processor and a memory:
the memory is used for storing the program codes and transmitting the program codes to the processor;
the processor is configured to execute the Unity3D location pointing method of the aforementioned Unity3D location pointing method embodiment according to instructions in the program code.
Also provided in an embodiment of the present application is a computer-readable storage medium for storing program code for executing the Unity3D location stationing method in the aforementioned Unity3D location stationing method embodiment.
Also provided in embodiments of the present application is a computer program product comprising instructions which, when run on a computer, cause the computer to perform the Unity3D located pointing method of the aforementioned Unity3D located pointing method embodiments.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (8)

1. A Unity3D positioning and point-distributing method is characterized by comprising the following steps:
101. constructing a preset body with the distance between a child object and a parent object equal to the radius of the earth model in Unity3D, wherein the parent object is located at the position of the sphere center of the earth model;
102. acquiring longitude and latitude data of a target fixed point object model, and converting the longitude and latitude data into rotation coordinate data under a space coordinate system;
103. instantiating the preset body to obtain a clone preset body, and assigning the position of the earth model and the rotating coordinate data to the clone preset body;
104. adding the target fixed point object model on the child object of the clone presetting body;
step 103 specifically comprises:
1031. instantiating the preset body to obtain a clone preset body;
1032. rotating the parent object of the cloning preset body according to the rotating coordinate data to enable the child object of the cloning preset body to rotate to the coordinate position corresponding to the rotating coordinate data;
1033. assigning the location of the earth model to the clonal presets such that children of the clonal presets are located on the earth model.
2. The Unity3D location dotting method according to claim 1, wherein step 101 is preceded by:
100. the earth model is generated in Unity 3D.
3. The Unity3D location dotting method according to claim 2, wherein the spatial coordinate system is:
and a Cartesian left-hand coordinate system is constructed by taking the sphere center of the earth model as the origin of coordinates and the equatorial plane of the earth model as an x axis.
4. A Unity3D location stationing device, comprising:
the building unit is used for building a preset body with the distance between a child object and a parent object equal to the radius of the earth model in Unity3D, wherein the parent object is positioned at the center of the earth model;
the conversion unit is used for acquiring longitude and latitude data of the target fixed point object model and converting the longitude and latitude data into rotation coordinate data under a space coordinate system;
the instantiation unit is used for instantiating the preset body to obtain a clone preset body and assigning the position of the earth model and the rotating coordinate data to the clone preset body;
a generating unit, configured to add the target fixed point object model to the child object of the clone preset entity;
the instantiation unit specifically comprises:
a clone subunit, configured to instantiate the preset body to obtain a clone preset body;
a rotation subunit, configured to rotate the parent object of the preset cloning object according to the rotation coordinate data, so that the child object of the preset cloning object rotates to a coordinate position corresponding to the rotation coordinate data;
and the fixed point subunit is used for assigning the position of the earth model to the clone presetting body so as to enable the sub-object of the clone presetting body to be fixed on the earth model. .
5. The Unity3D location spotting device of claim 4, further comprising:
a preprocessing unit for generating an earth model in Unity 3D;
the spatial coordinate system is as follows:
and a Cartesian left-hand coordinate system is constructed by taking the sphere center of the earth model as the origin of coordinates and the equatorial plane of the earth model as an x axis.
6. A Unity3D location pointing device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to execute the Unity3D location pointing method of any of claims 1-3 according to instructions in the program code.
7. A computer-readable storage medium, wherein the computer-readable storage medium is configured to store program code for performing the Unity3D location stationing method of any of claims 1-3.
8. A computer program product comprising instructions which, when run on a computer, cause the computer to perform the Unity3D location stationing method of any of claims 1-3.
CN201910218378.1A 2019-03-21 2019-03-21 Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium Active CN109887103B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910218378.1A CN109887103B (en) 2019-03-21 2019-03-21 Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910218378.1A CN109887103B (en) 2019-03-21 2019-03-21 Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN109887103A CN109887103A (en) 2019-06-14
CN109887103B true CN109887103B (en) 2021-08-06

Family

ID=66933541

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910218378.1A Active CN109887103B (en) 2019-03-21 2019-03-21 Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN109887103B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107767462A (en) * 2017-10-16 2018-03-06 北京视据科技有限公司 A kind of non-wearing augmented reality hologram display method and display systems
CN108304178A (en) * 2018-01-17 2018-07-20 珠海金山网络游戏科技有限公司 A kind of data set quoting method and system based on Unity3D

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101255461B1 (en) * 2011-09-28 2013-04-16 한국건설기술연구원 Position Measuring Method for street facility
CN109377560A (en) * 2018-10-26 2019-02-22 北京理工大学 A kind of method of Outdoor Augmented Reality military simulation-based training

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107767462A (en) * 2017-10-16 2018-03-06 北京视据科技有限公司 A kind of non-wearing augmented reality hologram display method and display systems
CN108304178A (en) * 2018-01-17 2018-07-20 珠海金山网络游戏科技有限公司 A kind of data set quoting method and system based on Unity3D

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ALGRIFF.How to Instantiate an object and set local position based on parent help would be great :.《3. https://forum.unity.com/threads/how-to-instantiate-an-object-and-set-local-position-based-on-parent-help-would-be-great.506391/》.2017, *
UNITY:代码动态加载Prefab预设体;河乐不为;《http://blog.csdn.net/linshuhe1/article/details/51355198》;20160509;全文 *
UNITY手册-在运行时实例化预制件;unity3d.com;《https://docs.pumachen.xyz/unity-doc/Manual/InstantiatingPrefabs.html》;20180331;全文 *

Also Published As

Publication number Publication date
CN109887103A (en) 2019-06-14

Similar Documents

Publication Publication Date Title
CN110411464B (en) Three-dimensional point cloud map generation method, device, equipment and storage medium
CN109903366B (en) Virtual model rendering method and device, storage medium and electronic equipment
CN108027653B (en) Haptic interaction in virtual environments
CN103886631A (en) Three-dimensional virtual indoor display system based on mobile equipment
CN112097770A (en) Multi-unmanned aerial vehicle collaborative full coverage path planning method and device, storage medium and terminal
CN105359054A (en) Locating and orienting device in space
CN110478898B (en) Configuration method and device of virtual scene in game, storage medium and electronic equipment
CN107452061A (en) Generation method, device, equipment and the computer-readable recording medium of building model based on oblique photograph technology
CN112749244A (en) Method and device for realizing digital twin city space coordinate system based on illusion engine and storage medium
CN108534789A (en) A kind of multipath elements of a fix unified approach, electronic equipment and readable storage medium storing program for executing
CN112132936A (en) Picture rendering method and device, computer equipment and storage medium
CN113696188A (en) Hand-eye calibration data acquisition method and device, electronic equipment and storage medium
CN114187589A (en) Target detection method, device, equipment and storage medium
CN111080755A (en) Motion calculation method and device, storage medium and electronic equipment
CN109887103B (en) Unity3D positioning and point-distributing method, device, equipment and computer-readable storage medium
CN111968239B (en) Memory, three-dimensional scene generation method, system and equipment based on DEM
CN115619986A (en) Scene roaming method, device, equipment and medium
CN109993834B (en) Positioning method and device of target object in virtual space
CN115113639B (en) Unmanned aerial vehicle flight control and simulation training method and device
CN114119684B (en) Marker point registration method based on tetrahedral structure
US20240046554A1 (en) Presenting virtual representation of real space using spatial transformation
CN113870426A (en) Three-dimensional space coordinate conversion method, storage medium and computing device
CN117130491B (en) Mixed reality multi-group cooperation method, system, electronic equipment and storage medium
CN109934909B (en) Method and device for reconstructing 3D model, electronic equipment and storage medium
CN113538490B (en) Video stream processing method and device

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