產品
體驗
應用程式及遊戲
支援
Meta 帳戶登場:您可以建立 Meta 帳戶來登入 VR 裝置。
了解詳情
META HORIZON 世界
學習製作內容
INTRO TO CREATION
INTRO TO HAND TOOLS
INTRO TO GIZMOS
INTRO TO SCRIPTING
PUBLISHING
LOCAL SCRIPTING
EVENTS
MOTION
ACTIONS
RESOURCES
瀏覽教學導覽
INTRO TO SCRIPTING
INTRO TO SCRIPTING
INTRO TO SCRIPTING
Welcome to Scripting in Horizon Worlds! In this series we are going to learn the fundamentals of the Script Gizmo, and then we will dive deeper into the tools and build a mini game.
SCRIPT GIZMO
The Script gizmo allows you to create dynamic and unique experiences. Seen below is the script gizmo, which can be opened by putting your pointer inside, and pressing forward on your thumbstick, similar to opening a property panel on other objects and gizmos.
EVENTS
When you plan your script, ask yourself, when does the thing you want to happen occur? This is where events come into play.
MOTION
The Motion tab allows you to move objects and players in your world. Objects have motion options that are both instant and over time.
ACTIONS
Actions offer an incredible way to interact with your world and players, often connecting to visual effects, sounds, text, and other gizmos. You can also reset the world, play haptic feedback, and adjust a player's voice settings.
OPERATORS
Operators are extremely powerful.
VALUES
The Values tab allows you to interact with variables using the SetTo codeblock. You can also interact with Player Variables, and get all types of value inputs to use in your scripts.
VARIABLES
Variables have a lot of uses, they are great for changing values like a timer, or durability.
CODEBLOCK TYPES
You may have started to notice there are a few different colors and shapes to the codeblocks.
SCRIPTING COMPONENTS
In the bottom right of the scripting panel, you’ll see a capacity meter.
CAPTURE THE FLAG SCRIPTS
WHEN TRIGGER IS ENTERED BY OBJECT
In this section we will be displaying a trophy when a flag enters a trigger.
COUNT OBJECTS IN TRIGGER
What if we want three flags in unique positions, before showing the trophy?
FIX COUNTING BUG
You might have noticed that our flags can be counted twice, causing the trophy to display early.
GAMIFYING WATER BALLOONS
OBJECT RESPAWN SCRIPT
Remember that water balloon we made in the Gizmos series? We are going to turn it into a game mechanic.
PERSISTENT PLAYER VARIABLES
Persistent Player Variables are an incredible tool for keeping track of player stats.
TRACK PLAYERS HIT
Now let’s use our score variable to track how many times a player has hit another player with a water balloon.
SCOREBOARD SCRIPT
TRACKING PLAYERS IN THE WORLD
Now that we are tracking player scores, we can build a scoreboard.
DISPLAYING SCORES
In our scoreboard, we need to create a display loop. Bring over When World is Started, and When Event is Received.
CREATING GAME LOOP
RANDOM SPAWN POINTS
This next script is not necessary, but if you are up to it, will add an awesome element of fun.
WORLD RESET OPTIONS
There are two ways to reset your world, either manually moving objects back to their original position and states, this is called a soft reset because you are in control of what’s changed.
RESET WORLD TROPHY
Back on our Trophy script, let’s add two lines to allow the players to reset the world. Bring over the Index Trigger event, and from Actions, grab Reset World. Now when the players win the trophy, they can reset the world.
THANK YOU FOR WATCHING
You have done absolutely wonderful and are well on your way to mastering scripting, great work! We have a lot of tutorials in and out of Horizon. Be sure to experiment in this world playing with these new tools, try out different ideas and combinations.
QUEST 3
QUEST PRO
QUEST 2
配件
RIFT S
應用程式及遊戲
支援
開發人員
工作專用 VR
所有產品
Quest 3
Quest Pro
Quest 2
Quest 2(翻新)
Rift S
配件
Quest
Go
Rift
比較頭戴式裝置
更多 META QUEST
討論區
網誌
推介
VR for Good
創作者
下載 SDK
關於
工作機會
Meta Connect
研究
所有產品
Quest 3
Quest Pro
Quest 2
Quest 2(翻新)
Rift S
配件
Quest
Go
Rift
比較頭戴式裝置
更多 META QUEST
討論區
網誌
推介
VR for Good
創作者
下載 SDK
關於
工作機會
Meta Connect
研究
私隱政策
法律聲明
© Meta 2024