Upload

Loading icon Loading...

This video is unavailable.

Raycast Force and Ejecting Bullet Shells in Unity 3d

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to like xenosmash's video.

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to dislike xenosmash's video.

Sign in to YouTube

Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to add xenosmash's video to your playlist.

Published on May 27, 2013

http://xenosmashgames.com/raycast-for...
In this Xenosmash tutorial we'll be showing you how to apply force to rigidbodies in our game with our raycast. We'll also go over how to "eject" bullet shells from our gun. We'll start off by modifying our previous raycast script by using "Add Force" which will apply a force to wherever we left click. We'll test this out on some cubes that have rigidbodies. We can adjust the force behind our raycast in the inspector panel.

To add some more realism we'll create a bullet eject script that will instantiate a bullet shell prefab from the side of our gun. We'll instantiate the bullet shells when we left click to match our shooting script. Every time we fire we'll instantiate one bullet shell. Create a bullet shell from a small cylinder, add a yellow/bronze like material to it just to make it look somewhat like a bullet casing. Make sure it has a rigidbody attached to it. Then create an empty game object and place it near the "eject" portion of the gun. Apply the "Eject" script to this empty game object and plug in the bullet shell prefab into this script.
Scripts used in this video: http://xenosmash.com/raycast-force-an...

  • Category

  • License

    Standard YouTube License

Loading icon Loading...

Loading icon Loading...

Loading icon Loading...

The interactive transcript could not be loaded.

Loading icon Loading...

Loading icon Loading...

Ratings have been disabled for this video.
Rating is available when the video has been rented.
This feature is not available right now. Please try again later.

Loading icon Loading...

Advertisement
Loading...
Working...
to add this to Watch Later

Add to