Shards632
9 months agoMentor
Weekly Creator Challenge #3: New Creators
New to Horizon Creator Challenge
New Creator Challenge: Create an Interactive Gun!
Challenge Overview
This challenge introduces you to the basics of player interaction mechanics in Meta Horizon Worlds.
You’ll learn how to:
- Get events when players interact with objects
- Fire projectiles from a launcher
- Detect hits and play appropriate effects
Duration: Mar 10, 2025 - Mar 14, 2025
Estimated Time: Approx. 45 min.
Mentor: Shards632
Rewards:
- Challenge Champion Badge 🏆
- NEW! Challenge Trifecta Badge 🏆🏆🏆 after completing three challenges
Need Help?
- Forum Support: I’ll be actively monitoring this thread during the Challenge duration to help you succeed
- Live AMA: Join my Typescript for HZW on Tuesday, March 11th at 12 PM PST
Challenge Steps:
1. Create Your Gun
- The geometry doesn't have to be complicated!
- When I need a gun, I often just slap together a cylinder for the barrel and a soft cube for the handle that I get from the primitives in the build menu, and put them in a grouped entity.
- Or, if you want, you can grab a gun out of the asset library from the build menu.
- The look of the gun isn't the important thing with this challenge, it's the interactivity.
- But go crazy if you have mad modeling skills and import something from Blender!
2. Add Interactive Components
- Add a projectile launcher gizmo within the gun group, positioned at the muzzle of the gun.
- Add 'firing' sounds or particle effects gizmos to the group, for when the user shoots.
- Add grab handles to the group, and adjust the grab anchor so that the avatar holds the gun by its grip/handle.
- Pull a sound gizmo out of the library for an explosion sound, and a smoke poof particle effect gizmo.
3. Create the Script
- Create a script called "Gun" attached to the gun group.
- Make a property for the projectile launcher, your launching sounds and particle effects, and your exploding sounds and particle effects.
- Listen in preStart() to the entity for 'OnIndexTriggerDown' to find out when the player fires the gun.
- Listen in preStart() to the launcher gizmo for 'OnProjectileHitWorld' for when the fired projectile hits something
4. Implement the Functionality
- When the player fires the gun, tell the projectile launcher gizmo to launch a projectile. If you have sounds and particle effects in the gun for firing, play those now!
- When the projectile launcher reports the projectile hit something, use the position information in the event to move the explosion sound particle effect to that location, and then tell them both to play!
5. Share your Creation
- Post your published world link and a screenshot to earn your “Challenge Champion” badge!
Skills You’ll Develop:
- Connecting entity properties to a script
- Connecting entity event code handlers for player and gizmo interactions
- Playing sounds and particle effects
What You’ll Need:
- Horizon Worlds Desktop Editor
- Visual Studio Code (configured to work with the Desktop Editor)
- Your Imagination!
Helpful Resources
Familiarize yourself with the APIs for the following:
- Grabbing and Holding Entities
- Player Input Events
- Projectile Launcher Gizmo
- Sound Gizmo
- Particle FX Gizmo
How to Earn Your Badge
- Build a world with gun that shoots a projectile and creates explosion effects
- Publish your world
- Post to this thread with:
- Your world link
- A screenshot of your avatar with your gun
- Brief feedback on your experience (difficulty level, what you learned, suggestions for future challenges)
P.S. Want more of a challenge? Try out the experienced creator challenge here.