Demo: Physics Grenade

2169k

Demo: Physics Grenade

Updated 8/31/2020 (see more)

Originally published: 3/5/2020

Pull the pin on these grenades and throw them at the bunker to see it explode using physics!

Controls

  • Pick up: Click on a grenade
  • Pull pin: click while holding the grenade
  • Throw: On PC press G while moving to toss it. In VR, press your controller's grip button while throwing to toss it.

Effects

  • Grenade explosion will apply a force on any physics objects around it.
  • Explosion will damage anything or Player near it, if they have hitpoints.
  • Grenade cleans itself up after explosion, leaving no objects in the scene.

Background
When the Physics feature was added to the Builder in the 5.0 update, I really wanted to try creating something that would actually explode objects around it, like an actual explosion.

It took me a minute to figure out how to do it though, since physics objects require a force to move. In other words, I needed to push them with something to apply a physics force to them.

Applying a force is simple enough; just animate an object toward another physics object and they'll collide! The trickier part is applying an invisible force, like a shockwave in an actual explosion, and containing it within an object that the player can throw.

The key was having a totally transparent object (a cube in this case) animate outward very quickly, when a countdown timer variable on the grenade reached zero. The same countdown timer also triggers the explosion effect, sound, and destroys the grenade itself.

This is a templated experience, so feel free to explore how it works and even save it as a model to use in your own games!

    Comments

     
    Loading…
    You can also:
    By cpfTeam

    On Hubs

    This experience is also published on:

    More From This Author

    (published on games)