Shot fire Object
A lot going on.
We create a game object called “Bolt” and add a child object(quad) called VFX. We make this two parts so we can separate the logic from rendering.
- Game Object called “Bolt” This will be our primary shot object. The bolt object has movement(rigid body) and collision detection(capsule collider)
- Child Game object called VFX(quad) (transform rotate 90 to see)
- Create a material
- Go to material folder
- Create new new material and name it fx_bolt_orange
- Use the “select” picker to attach the texture of the bolt
- Select shading as mobile/particles/additive
- Drag and drop new material onto Quad
- Setup collision
- Remove “mesh collider” from VFX object(there by default)
- Go to Bolt and add component physics/capsule collider
- Adjust the size
- Change Direction to z-axis
- Select “isTrigger” checkbox to make it a “trigger collider”
- Attach a new Script called “Mover”
- see the new public “speed” set that on the Bolt object(20 is ok)
- Test by playing.
- Move it to Prefab
- Test by playing and drag and drop as often as you want.
Create new Material
fx_bolt_orange