Infinity PBR by Magic Pig Games
  • Infinity PBR Documentation
  • Game Modules 4
    • ➡️Quick Start
    • 📽️Video Tutorials
      • Quick Start: Creating Game Module Objects
      • Automating Start Actions on GameModulesActor
      • Inflicting Damage with Conditions
      • Updating UI (and more) with Blackboard Notes
      • Dynamic Menus with Item Objects and Dictionaries
      • Create Custom Quest Rewards
      • Save and Load Game Data
      • Stats: Deep Dive
      • Items: Deep Dive
      • Conditions: Deep Dive
      • First Person Movement
      • Tutorial: "Overheal" Effect with Condition & Stats
      • Tutorial: Create a Character & Actor Class Inheriting from GameModulesActor
    • 👀Game Modules Viewer
      • Viewer: Dictionaries
      • Viewer: Stat / GameStatList
      • Viewer: ItemObject / GameItemObjectList
      • Viewer: ItemAttribute / GameItemAttributeList
      • Viewer: Condition / GameConditionList
      • Viewer: Quest / GameQuestList
    • V4 Migration Tips
      • Introducing GameModulesActor
      • Interfaces
      • No More Tick*
      • Dictionaries
      • Repositories
      • Tips from Upgrading "Legend of the Stones"
    • Important Information
      • Game Modules Overview
      • Inherit from GameModulesActor
      • Things to not forget to do
      • Bugs, Backups, and Demos
      • FAQ / Tips & Tricks
      • Required Prefabs
      • Game Module Repository
      • Release Notes
    • Module Documentation
      • Game Modules Actor
      • Game Module "Lists"
        • Get() Methods
          • GameStatList Get() Methods
          • GameItemObjectList Get() Methods
          • GameItemAttribute Get() Methods
          • GameConditionList Get() Methods
          • GameQuestList Get() Methods
        • Contains() Methods
          • GameStatList Contains() Methods
          • GameItemObjectList Contains() Methods
          • GameItemAttributeList Contains() Methods
          • GameConditionList Contains() Methods
          • GameQuestList Contains() Methods
        • Count() Methods
          • GameStatList Count() Methods
          • GameItemObjectList Count() Methods
          • GameItemAttributeList Count() Methods
          • GameConditionList Count() Methods
          • GameQuestList Count() Methods
        • Remove() Methods
          • GameStatList Remove() Methods
          • GameItemObjectList Remove() Methods
          • GameItemAttributeList Remove() Methods
          • GameConditionList Remove() Methods
          • GameQuestList Remove() Methods
        • GameStatList
        • GameItemObjectList
        • GameItemAttributeList
        • GameQuestList
        • GameConditionList
      • Blackboard
        • Blackboard.cs
        • Blackboard Follower
        • Blackboard Note
        • Blackboard Event
        • Blackboard Values
        • Tips & Tricks
          • Use extension methods to check BlackboardNotes (or events)
      • Stats
        • IHaveStats
        • Stat.cs
        • GameStat.cs
        • GameStatList.cs
        • Mastery Levels
      • Loot
        • LootItems.cs
        • LootBox.cs
        • GameLootBox.cs
        • Generating & Handling Loot
        • Custom Loot Generation Algorithm
      • Items
        • ItemObject.cs
          • Manage Item Objects
          • Allowed Item Attributes
          • Starting Item Attributes
          • Item Attribute Variables
            • Variables Methods
        • GameItemObject.cs
        • GameItemObjectList.cs
        • ItemAttribute.cs
          • Manage Item Attributes
          • General Settings
          • Name Settings
          • Requisite Attributes
        • GameItemAttribute.cs
        • GameItemAttributeList.cs
        • Code Examples
      • Conditions
        • Condition.cs
          • Main Settings
          • Condition Time
          • Effects on Points
        • GameCondition.cs
        • GameConditionList.cs
        • Expiration Condition Handler
        • Code Examples
      • Quests
        • Quest
          • Main Settings
          • Quest Step Settings
        • Quest Steps
        • Quest Conditions
          • Create a Custom Quest Condition
            • Your Quest Condition
            • Your Quest Condition Editor
            • Your Quest Condition Drawer
          • Quest Condition Details
            • Blackboard Value Bool
            • Blackboard Value GameObject
            • Blackboard Value Number
            • Blackboard Value String
            • Final Stat Is
            • Game Condition List Contains
            • Game Item Object List Contains
            • Game Stat List Contains
          • Quest Condition Enums
        • Quest Rewards
          • Create a Custom Quest Reward
            • Your Quest Reward
            • Your Quest Reward Editor
            • Your Quest Reward Drawer
          • Quest Reward Details
            • Point Reward
            • Condition Reward
            • Quest Quest Reward
            • Item Object Reward
          • Custom Quest Reward Handler
        • GameQuest
        • GameQuestList
        • Quest Events
        • Demo Scene Quests
          • Push the Button
          • Add Money
          • Don't Get Poisoned
          • Rescue the Puppy
      • Voices
        • Voices
        • Voice.cs
        • Code Examples
      • Dictionaries
        • Dictionaries Setup
        • Dictionaries Methods
        • KeyValue Methods
        • Save and Load
        • Object Reference
      • Gametime & Timeboard
        • Timeboard
          • Timeboard Events
          • TimeboardFollower
        • Gametime
          • Pause Level
          • Time Options
          • Properties & Methods
        • TimeSpan
        • Code Examples
      • Property Code
      • Lookup Table
      • Save and Load
        • GameList & GameFile
        • Making objects saveable
        • Saving, and Loading
        • BlackboardEvents sent by Save and Load
    • Game Module "Systems"
      • Drag-and-Drop Inventory System
        • Scripts
          • PanelManager
          • OnScreenItem
          • Panel
          • BoxManager
        • Scene & Class Setup
        • Item / Object Setup
        • Item / Inventory Setup
        • Box Setup (Chests, Bags, Other Inventories)
        • Setup Your Scene
      • First Person Movement
      • Character Creation
    • Game Module Demo Projects
      • Party Based RPG
        • Title Scene
        • Character Creation Scene
        • World & Dungeon Scenes
    • Magic Time for Game Modules
  • ✨Northstar Tracking System
    • ✅Overview & Quickstart
      • ➡️Quick Start
      • 🫐Demo Scene
      • 🛠️Customizing & Overriding
        • Create a Custom Navigation Bar
        • Create a Custom Compass / Radar
        • Runtime Overrides
          • Screen & Edge Overlay
          • Navigation Bar
          • Compass / Radar
      • ☄️Tips & Code Examples
    • Northstar Documentation
      • Global Northstar Settings
      • Northstar Overlay Settings
      • Compass & Radar
        • Compass
        • Radar
      • Northstar Screen Overlay
        • Screen & Edge Overlay
        • Navigation Bar
      • Tracked Target Compass Radar
      • Tracked Target Overlay
        • Types
        • Override Values
      • Overlay Icon
      • Compass Icon
      • Distance Text
  • 🚀Projectile Factory
    • 👀Overview & Quickstart
      • ➡️Quick Start Guide
        • Create Your First Projectile
        • Add Projectile Factory & Create a Projectile Spawner
        • Use 3rd Party Integrations
        • Extending Projectile Factory
        • Making Lasers & Similar Attached Projectiles
      • 💡FAQs + Important Reminders
    • Game Modules 4 Integration
      • Projectiles with TimeMod
    • Magic Time for Projectile Factory
    • ✅3rd Party Particle Integrations [16]
      • ▶️Archanor VFX [5]
        • Sci-Fi Arsenal
        • Polygon Arsenal
        • Magic Arsenal
        • Retro Arsenal
        • Rainbow Magic
      • ▶️Gabriel Aguiar Prod [2]
        • Unique Projectiles Vol. 1
        • Unique Projectiles Vol. 2
      • ▶️HOVL Studio [4]
        • Toon Projectiles
        • Toon Projectiles 2
        • AAA Stylized Projectiles Vol. 1
        • AAA Projectiles Vol. 2
      • ▶️kripto289 [1]
        • Realistic Effects Pack 4
      • ▶️FORGE3D [1]
        • Sci-Fi Effects
      • ▶️Knife [1]
        • PRO Effects - Sci-Fi Shooter FX
      • ▶️Jean Moreno [1]
        • Cartoon FX Remastered
      • ▶️Synty Studios [1]
        • 🟡Synty Studios Particles
    • Projectile Factory Documentation
      • 🔫Projectile Spawner
        • Projectile Spawner Code
      • 🚀Projectile
        • Projectile Code
        • Projectile Data
      • ✨Spawn Behavior
        • Spawn Behavior Code
        • Spawn Behavior Modification
      • 🕊️Behaviors
        • Behavior Examples
      • ⚡Events
      • 👁️Observers, Global Observers, and Observer Objects
        • Toggle Objects At Events Observer Object
      • 👩‍💼Factory Manager
      • 🏹Trajectory
      • 🎱Object Pooling
      • 🤩Create Custom Behaviors
      • Spawn Point Manager
      • Helper Tools
        • Projectiles Quick Editor
        • Set Trail Auto Destroy to False
        • Set Layer of All Projectiles
        • Remove Colliders
      • Additional Scripts
        • Destroy or Pool Object
        • Project Force
        • Raycast Shooter + Handlers
        • Projectile Utilities
  • Additional Systems & Tools
    • 🎨Runtime Color Sampler
      • Quick Start
      • Demo Walkthrough
      • Runtime Color Sampler (Prefab & Class)
        • Sampler Sphere
        • Sampler Camera
      • Runtime Listener
      • Runtime Color Settings
      • Scripting
      • Additional Classes
    • 🙎‍♀️Portrait Avatars
      • Setup
        • Create a Portrait Avatar
        • Create a UI Portrait
      • Portrait Avatars
        • Scripting
      • Portrait3D
      • Portrait2D
      • Portrait UI
      • Avatar Camera
      • Important Considerations
    • 🎛️Audio Clip Combiner
    • 🌈Color Shifter
    • 🛠️Support Classes
      • Utilities.cs
      • InfinityExtensions.cs
  • ⌛Magic Time - Local Time Scale
    • Overview
    • ➡️Quick Start
    • 🛠️Integrations
    • 💡FAQ
    • Local Time Scale
      • Local Time Scale Scripting
    • Magic Time Manager
      • Magic Time Manager Scripting
    • Magic Time User
      • IHaveLocalTime
      • Magic Time User Scripting
      • Additional "Magic Time User" Components
    • Time Zone
  • Equipment Systems
    • Overview
    • Blend Shapes Manager
    • Blend Shapes Preset Manager
    • Prefab and Object Manager
      • Humanoid Demo & Setup
      • EquipmentObject.cs
      • Prefab Groups
      • Variables
      • Scripting Examples
    • Wardrobe Prefab Manager
  • 📽️General Tutorials
    • Quick 3rd Person Controller
  • ⚔️Legend of the Stones
    • Actors, Players, NPCs
    • Systems
      • Game State
  • External Links
  • Get them at the Asset Store
  • Connect on Discord
  • YouTube
  • Twitch
  • 🚧Work In Progress / Coming Soon
Powered by GitBook
On this page
  • Create the Projectile
  • 1. Bring the particle / object into the scene
  • 2. Add a "Projectile" class to the object
  • 3. Set Projectile Data and Spawn Behavior
  • 4. Set behaviors
  • 5. Add Rigidbody + Other Settings
  • OPTIONAL: Test it!
  • 6. Set up muzzle & impact particles
  • 7. Turn particles into Projectile Factory objects
  • 8. Add the Behaviors
  • OPTIONAL: Test it!
  • You're done!

Was this helpful?

  1. Projectile Factory
  2. Overview & Quickstart
  3. Quick Start Guide

Create Your First Projectile

v1.0

PreviousQuick Start GuideNextAdd Projectile Factory & Create a Projectile Spawner

Last updated 1 year ago

Was this helpful?

Creating your own projectiles is easy. Here we'll create a from scratch, though you can of course copy the existing projectiles and modify them as you'd like.

For this tutorial, we'll be using from the . These don't have any extra scripts, so setting them up is very straight forward. Whether you're using content from the Asset Store or creating your own, these steps will get you spawning projectiles fast!

Many projectiles consist of three parts.

  1. The projectile itself. This is the thing that moves through the world.

  2. The impact particle. Often an explosion.

  3. A muzzle particle. Or perhaps some other sort of "on launch" partile.

Of course projectiles can have all sorts of additional features, and don't need to have anything extra. For this tutorial, we'll be setting up a projectile with the three parts listed above.

Create the Projectile

1. Bring the particle / object into the scene

First, bring the particle or object into the scene. If you'd like to rename the object, now is a great time to do so.

2. Add a "Projectile" class to the object

Add the Projectile component to the object. The custom Inspector should help make it quick and easy to set up the Projectile.

3. Set Projectile Data and Spawn Behavior

I'll choose "Speed 40" and "Machine Gun" respectively.

Remember, changing the details on these objects will affect all Projectiles which use the same behavior or data. If you want to change values and only affect this projectile, click the "Replace w/ Copy" button, which will allow you to copy the selected object into a new object, which only this projectile will be using.

4. Set behaviors

Right now, we want to get the projectile doing the basic lifecycle: Move, collide, destroy. So we will add three Behaviors.

5. Add Rigidbody + Other Settings

Before this will work, we need to add a Rigidbody, and we'll turn off "Use Gravity" on that, so that gravity doesn't affect the projectile.

Now is a great time to also change the Layer that the projectile is on. Generally you'll want Projectiles to be on their own layer, to avoid having them collide with each other, or choose other Projectiles to target.

OPTIONAL: Test it!

To teset this, I've added the Projectile to one of the demo scene spawners.

But...it's not exciting enough! Lets add a muzzle flash and impact particle.

6. Set up muzzle & impact particles

Bring the muzzle and impact particles you want to use into the scene. Both will be set up in very similar ways, so we can do both at the same time. Rename them as you'd like.

Add some juice!

Setting the force mode to "Impulse" will provide a one-time physics based push. With the settings above, the force will be projected in the forward direction of the particle with a 30 degree sphereacle angle.

7. Turn particles into Projectile Factory objects

First, save these as prefabs in your project.

Projectile Factory comes with two shortcut options that make this easy! First, select the muzzle prefab in your Project view. Right click and select "Create/Projectile Factory/Shortcuts/Selections -> Create Object at Spawn Position (Spawn Behavior Modification")

This will automatically create a very common Spawn Behavior Modification, "Create Object at Spawn Position", with this particle already assigned.

Do the same thing for the impact particle, but this time choose "Selections -> Spawn On Impact Object (Behavior)".

Setting up a lot of particles at once? You can use the shortcuts with multiple particles selected, making it super quick to create many objects at once!

8. Add the Behaviors

Add the Spawn Behavior Modification and the Behavior to your Projectile.

You can use the "Select" option to either pick the file from the pop up, or drag the object from the Project view into the object field.

Or, use the search feature to search the available objects, then click the "Add" button. You should see the objects appear in the list.

Don't forget to save your prefab!

OPTIONAL: Test it!

Great! Now we have a muzzle flash and an impact explosion. Because we're using Object Pooling, we can see the objects being created and then re-used in the Heirarchy.

You're done!

That's it! We now have a fully functional, and quite exciting, projectile!

Not all features of a projectile have to come from the Projectile Factory behaviors. We have many that do cool things, and many particles -- especially those from the Asset Store -- will come with audio already attached to the particle.

The first two things to set are the , which will control the speed of the projectile, and the , which determines how the projectile is spawned. You can create your own, but Projectile Factory ships with many ready to go, so we'll select two that already exist.

How your projectile acts is determined by the you choose. There are many behaviors that ship with Projectile Factory, and you as well.

It's working! The projectile moves forward, collides with the wall, and is destroyed. We can even see the camera shaking, since the projectile has automatically registered itself with the . The camera is a and will shake whenever any particle collides.

To set these up, start by adding a component to them.

The default settings will likely work in most scenarios. As shown above, 5 seconds after the projectile is set, the object will be destroyed or sent to the , depending on the settings of the Projectile itself. By default, the object pool will be used. The projectile is set when the object is created (instantiated or brough in from the pool), so no changes are needed. Add this to both particles.

Lets add a component onto the impact particle as well.

The "Muzzle" particle will be brought in when the Projectile spawns, so we'll need to make a for that, and the impact particle will be brought in when the Projectile collides with something. We'll need a for the impact.

You can experiment with changing the , , and other settings to create new projectiles, if you'd like.

Next learn how to , including how to set up your first .

🚀
👀
➡️
additional scripts
Projectile Data
Spawn Behavior
Behaviors
can create your own behaviors
Factory Manager
Global Observer
Destroy or Pool Object
Object Pool
Project Force
Spawn Behavior Modification
Behavior
Spawn Behavior
Behaviors
add a Projectile Factory to your scene
Projectile Spawner
Add Projectile Factory & Create a Projectile Spawner
Projectile
Magic Arsenal by Archanor
Asset Store