Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wmcnamara/unity-stickybomb

A stickybomb script for Unity that applies explosion force to nearby rigidbodies, and will play effects/sounds.
https://github.com/wmcnamara/unity-stickybomb

3d cs csharp physics stickybomb unity unity3d

Last synced: about 2 months ago
JSON representation

A stickybomb script for Unity that applies explosion force to nearby rigidbodies, and will play effects/sounds.

Awesome Lists containing this project

README

        

# Sticky Bomb Unity Script

A simple stickybomb script that applies explosion force to nearby rigidbodies, and will play effects/sounds.

Contained in a single script/prefab, and is highly customizable.

# Example

![StickyBomb Showcase](StickybombShowcase.gif)
(if you see weird checkerboarding on the gif, its because of video compression)

# Using The Stickybomb
If you just want to use the stickybomb, copy the `Assets/Stickybomb` folder into your project.

It contains a prefab, the Stickybomb.cs file, some materials, a particle effect and a sound.

## What you should know

By itself, the sticky bomb will:

1. When spawned, will move based on physics (fall based on gravity)
2. Attach to the first object it hits, and then explode 1 second later

You should add your own logic for throwing/moving the stickybomb, and spawning it.

If you want to stop the stickybomb from sticking to anything/exploding, and falling down, call `.DisablePhysics()`.
You can call `.EnablePhysics()` to reactivate the stickybomb.

When deactivated, the stickybomb will not stick to anything, and will not have gravity. This is useful if your player needs to carry the stickybomb around before throwing it, for example.

Disabling the stickybomb effectively just makes the rigidbody attached to the bomb kinematic.

## Keep in mind:
- To attach to an object, the object it should attach to must have a collider.
- To be effected by explosions from the stickybomb, an object must have a collider and rigidbody.
- The stickybomb object needs a rigidbody and collider to operate.
- The sound will only play if an explosion effect is also configured.

Feel free to open an issue if you have any questions.