Cov txheej txheem:

Muab AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees: 8 Kauj Ruam (nrog Duab)
Muab AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees: 8 Kauj Ruam (nrog Duab)

Video: Muab AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees: 8 Kauj Ruam (nrog Duab)

Video: Muab AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees: 8 Kauj Ruam (nrog Duab)
Video: Casio G-SHOCK GBD800-1B | Black G Shock G-SQUAD Step Tracker GBD-800 Топ 10 вещей 2024, Kaum ib hlis
Anonim
Tso AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees
Tso AR Cov Hom Phiaj ntawm GPS Ua Haujlwm hauv Kev Ncaj Ncees

Cov lus qhia no yuav dhau mus ua mobile app rau tso AR khoom ntawm GPS ua haujlwm nrog ARkit thiab ARCore siv Unity3D. Kuv yuav taug kev koj los ntawm kev teeb tsa ib qhov haujlwm uas kuv tau siv Mapbox uas tso cai rau peb los sau cov lus ntawm qhov chaw tshwj xeeb GPS thiab sau lawv mus rau GameSparks database.

Txhua qhov software thiab cov phiaj xwm peb yuav siv ntawm no yog pub dawb.

Rub tawm Unity 3D ntawm no yog tias koj tsis muaj nws:

unity3d.com/

Kauj Ruam 1: Cov teeb meem…

Teeb meem …
Teeb meem …

Yog li qhov no tsis yog qhov yooj yim app los ua nrog cov kev txwv tam sim no ntawm mobile GPS thiab mobile compass.

Ua siab ncaj cov khoom pom qhov twg lawv xav tias yuav muaj txog 50% ntawm lub sijhawm. Yog li cov txiaj ntsig tsis zoo, tab sis lawv ua tau raug dua qhov ze koj mus rau cov khoom.

Txawm li cas los xij, Kuv xav tias txoj hauv kev zoo dua rau GPS raws AR ntawm lub sijhawm no yuav siv daim ntawv qhia zoo li pokemon mus thiab thaum koj mus ze rau ib qho khoom uas lub koob yees duab qhib thiab koj tsuas pom cov khoom ntawd nyob ntawm koj xub ntiag. Yav tom ntej kuv xav ua qhov qhia tag nrho ntawm kev siv yooj yim dua li ntawd.

Ob txoj kev twg kuv tau siv Mapbox ua ntej thiab kuv paub tias lawv muaj chav kawm hloov dua siab tshiab uas muaj lub luag haujlwm rau hloov GPS ua haujlwm mus rau kev sib koom ua ke hauv ntiaj teb. Kuv xav tias kuv tuaj yeem hla dhau qee qhov GPS tswj hwm thiab lawv yuav tshwm nyob qhov twg kuv xav tau. Tsis ua hauj lwm

Cov khoom pom tau zoo txheeb ze rau ib leeg tab sis lawv tsis tau nyob hauv qhov chaw raug. Yog li kuv tau ua qee qhov kev tshawb fawb thiab pom tias Kuv Lub Koob Yees Duab xav tau los ua kom haum nrog sab qaum teb tseeb kom cov khoom pom nyob hauv qhov chaw raug.

Qhov teeb meem yog lub koob yees duab hauv koj lub xov tooj yeej tsis raug qhov tseeb.

Kauj ruam 2: Stupid Compass

Stupid Compass
Stupid Compass
Ruam ruam Compass
Ruam ruam Compass

Qhov teeb meem tseem ceeb yog thaum koj tso cov khoom nyob deb ntawm lub koob yees duab, yog tias koj lub xov tooj lub tswv yim ntawm sab qaum teb muaj tseeb txawm tias nyob deb li ob peb qib, cov khoom nyob deb yuav tshwm nyob deb heev.

Kuv yuav luag muab qhov kev nqis peev no tab sis ib tus phooj ywg hais rau kuv txog qhov haujlwm GitHub no:

github.com/mapbox/mapbox-ar-unity

Qhov no yog kev sim ua "ntiaj teb nplai" AR los ntawm Mapbox qhov twg cov khoom raug thauj mus rau GPS kev tswj hwm kom qhov kev paub dhau los ntawm kev muaj peev xwm tuaj yeem ua haujlwm sab nraud nyob deb deb ntau dua li tsuas yog sab hauv chav me hauv koj lub tsev.

Lawv txoj haujlwm siv AR Txoj Haujlwm deltas thiab GPS Txoj Haujlwm deltas los xam lub kaum sab xis uas yog qhov offset los ntawm AR lub koob yees duab mus rau sab qaum teb tseeb. Yog li pib siv GPS nyeem ntawv thaum tus neeg siv pib lub app thiab kom lawv taug kev hauv kab ncaj thiab nqa lwm qhov nyeem GPS. Tom qab ntawd nrog ob lub ntsiab lus no koj tuaj yeem qhia qhov kev taw qhia uas tus neeg tau taug kev (piv txwv tias lawv lub koob yees duab tau taw qhia rau hauv txoj kev lawv taug kev). Lawv pom tias qhov no muaj tseeb dua li siv lub koob thaij hauv xov tooj.

Lwm qhov teeb meem lawv sim daws yog drift nrog ARkit. Kev taug qab yog qhov zoo hauv ib chav me me tab sis thaum koj sab nraud taug kev mus deb AR cov khoom mus kom deb deb ntawm qhov chaw uas lawv xav tau.

Kauj Ruam 3: Thaum kawg Kev Tshuaj

Thaum kawg Kev daws!
Thaum kawg Kev daws!

Yog li qhov Mapbox txoj haujlwm no tau muab txoj hauv kev kom tau txais txoj kev ntseeg siab tig mus rau sab qaum teb kom muaj tseeb yog li txhua yam uas tau tso tseg tsuas yog tso cov khoom hauv ntiaj teb.

Kuv tau xaus qhov ua piv txwv me ntsis yog li kuv tuaj yeem sau cov ntawv xov ntawm qhov chaw GPS tshwj xeeb thiab tom qab ntawd sau cov ntaub ntawv ntawd mus rau GameSparks database. Qhov ntawd yog qhov kuv yuav qhia koj yuav siv li cas.

Qhov teeb meem nkaus xwb nrog txoj haujlwm no yog qhov koj yuav tsum tau ua kom zoo ua ntej nws tuaj yeem siv tau.

Kuv txhais li cas los ntawm kev sib dhos yog tias txij li Mapbox siv txoj haujlwm deltas los xam nqe lus, thaum koj xub qhib lub app thiab koj yuav tsum ua kom ntseeg tau tias lub dav hlau hauv av tau kuaj pom thiab tom qab ntawd taug kev hauv kab ncaj rau ib pliag kom txog thaum ntsuas kom raug.

Hauv qhov kev nkag siab UX yog lwm qhov teeb meem tab sis hauv kev txhim kho ntawm txoj haujlwm lawv muab piv txwv ntawm kev muab cov vuas tso rau pem hauv ntej ntawm tus neeg siv taug kev hla kom ntseeg tau tias muaj kev sib dhos zoo.

Yog li tam sim no koj paub qhov txwv ntawm txoj haujlwm no cia kuv qhia koj yuav siv nws li cas thiaj tuaj yeem ua si ib puag ncig. Thaum kawg koj yuav tsum tsim tus accountboxbox account thiab gameparks tus account ob qho uas yog pub dawb. Kuv siv gameparks tsuas yog li ntawd kuv tuaj yeem txuag GPS tswj hwm qhov chaw vim tias thaum sim koj yuav rov pib dua thiab rov tsim dua lub app ntau zaus.

Tsis tas li, qhov no yuav tsum ua haujlwm nrog ob qho ARkit thiab ARcore tab sis kuv tsuas muaj iPhone nyob rau lub sijhawm tam sim ntawd yog txhua yam kuv tuaj yeem sim.

Kauj ruam 4: Cia Tau Txais App Ua Haujlwm

Cia kom App ua haujlwm!
Cia kom App ua haujlwm!

Thawj yam ua ntej rub tawm txoj haujlwm no los ntawm GitHub:

Txuag cov ntawv rau koj lub desktop thiab qhib nws hauv Unity.

Mus rau cov ntawv, tsim chaw, thiab hloov koj lub platform mus rau Android lossis IOS.

Tam sim no mus rau Mapbox.com thiab tsim ib tus as khauj yog tias koj tseem tsis tau muaj.

Lob koj tus lej API thiab rov qab mus rau Kev Sib Koom, nyem rau ntawm Mapbox tab nyob rau sab saum toj, thiab nyem teeb tsa. Muab tshuaj txhuam rau hauv koj tus lej API nyob ntawd.

Tam sim no tsim tus as khauj ntawm GameSparks.com thiab nyem lub pob nyob rau sab saum toj sab xis los tsim ib qho app tshiab.

Hu nws txhua yam koj xav tau thiab theej koj tus lej API thiab app zais cia. Rov qab mus rau Kev Sib Koom thiab nrhiav GameSparks tab nyob rau saum toj. Nyem rau teeb tsa thiab muab koj daim ntawv pov thawj tso rau hauv ib yam nkaus.

Kauj Ruam 5: Kho Kho GameSparks

Kho qhov GameSparks
Kho qhov GameSparks

Tam sim no ua ntej lub app yuav ua haujlwm, peb yuav tsum teeb tsa peb lub database.

GameSparks siv noSQL yog li peb yuav tsum xub tsim cov khoom sau thiab ntxiv cov xwm txheej uas peb app siv los nyeem, sau, thiab rho tawm los ntawm server.

Ua ntej tsim cov khoom sau tshiab ntawm GameSparks lub vev xaib thiab hu nws txhua yam koj xav tau.

Tam sim no peb yuav tsum tsim 3 cov xwm txheej.

Thawj qhov app yuav tsum tau ua yog sau cov lus tawm mus rau lub hauv paus.

Cov lus muaj qhov latitude, longitude, thiab tom qab ntawv cov lus.

Yog li mus rau tus tsim thiab ntxiv qhov xwm txheej tshiab. Ua tus lej luv "SAVE_GEO_MESSAGE".

Muab txhua yam koj xav tau rau lub npe thiab lus piav qhia.

Ntxiv cov cai luv rau 3 tus cwj pwm:

"LOJ" "LON"

"TEXT"

Teem txhua hom ntaub ntawv rau txoj hlua thiab teeb tus nqi ua ntej rau 0. Ua lub hom phiaj sib sau ua ke ntawm txhua tus rau "siv hauv tsab ntawv."

Kauj Ruam 6: Ntxiv Qhov Txheej Txheem Kawg …

Ntxiv Cov Txheej Txheem Kawg …
Ntxiv Cov Txheej Txheem Kawg …

Lub app tseem xav tau thauj tag nrho cov lus los ntawm lub hauv paus thiab nyeem lawv rau hauv Kev Sib Koom thaum lub app pib kom peb tuaj yeem tso cov lus AR uas tau khaws cia hauv lub database.

Tsim lwm qhov xwm txheej thiab hu nws "LOAD_MESSAGE"

Qhov xwm txheej no tsis xav tau tus cwj pwm. Ib zaug ntxiv tso txhua yam koj xav tau rau lub npe thiab lus piav qhia.

Ua tib yam rau lwm qhov xwm txheej thiab hu nws "REMOVE_MESSAGES"

Qhov no txawm tsis xav tau tus yam ntxwv ib yam nkaus.

Tam sim no qhov kawg uas peb yuav tsum tau ua yog ntxiv qee qhov "huab chaws" lossis tus lej server sab uas tau hu thaum txhua qhov kev tshwm sim tau pib los ntawm peb lub app.

Kauj Ruam 7: Ntxiv Cloud Code

Hauv GameSparks mus rau teeb tsa thiab huab chaws.

Peb yuav tsum ntxiv ib tsab ntawv rau txhua qhov xwm txheej uas peb nyuam qhuav ua.

Hauv LOAD_MESSAGE qhov xwm txheej ntxiv cov cai no thiab txuag nws:

var messageData = Spark.runtimeCollection ("GeoMessage");

var tus cursor = messageData.find ();

var allMessages = ;

thaum (cursor.hasNext ()) {

var obj = cursor.next ();

rho tawm (obj ["_id"]);

allMessages.push (obj);

}

Spark.setScriptData ("all_Messages", allMessages); // xa tag nrho cov ntaub ntawv

Hauv REMOVE_MESSAGES qhov xwm txheej ntxiv cov cai no:

var messageData = Spark.runtimeCollection ("GeoMessage");

messageData.remove ({});

Thaum kawg hauv SAVE_MESSAGES kev tshwm sim ntxiv qhov no:

var geoMessageList = Spark.runtimeCollection ("GeoMessage");

var messageLat = Spark.getData (). LAT;

var messageLon = Spark.getData (). LON;

var messageText = Spark.getData (). TEXT;

var currentMessage = {

"messLat": messageLat,

"messLon": messageLon,

"messText": messageText,

};

geoMessageList.insert (currentMessage);

Kauj Ruam 8: Peb Ua Tiav lawm

Peb Ua Tiav lawm!
Peb Ua Tiav lawm!

Txoj haujlwm no siv tus lej tshwj xeeb ntawm koj lub cuab yeej los txheeb xyuas qhov tseeb nrog GameSparks server yog li tam sim no koj tuaj yeem rov qab mus rau Kev Sib Koom thiab nyem ua si, thiab koj yuav tsum pom hauv lub console "ntaus ntawv lees paub …"

Tam sim no mus rau cov ntawv, tsim chaw, thiab nyem tsim. Yog tias koj tsis tau ua ib qho app rau Android lossis IOS koj yuav xav teeb tsa tus lej txhim kho nrog Google lossis Apple.

Thaum lub app nyob ntawm koj lub xov tooj koj yuav tsum xub ua kom ntseeg tau tias ARKit lossis ARCore kuaj pom lub dav hlau hauv av. Tam sim no nyem lub pob khawm nyob hauv qab kaum sab laug. Taug kev tom ntej ob peb kauj ruam thiab koj yuav pom "suav ua ke" los hauv lub teeb xiav. Tam sim no lub khawm UI yuav tsum tshwm sim thiab yog tias muaj cov lus tau rub hauv koj lub database lawv yuav raug tso rau hauv ntiaj teb.

Txhawm rau cim GPS tshiab AR lus nyob qhov twg taug kev mus rau qhov chaw koj xav kom cov lus yog thiab nyem lub cim lus nyob rau sab xis saum toj ntawm lub vijtsam. Ntaus txhua yam lus koj xav tau thiab nyem lub pob tus lej!

Pom zoo: