• Home  / 
  • Unity3D
  •  /  7 VR / VIVE Games – Day 2 – Archery

7 VR / VIVE Games – Day 2 – Archery

VIVE - Archery

HTC VIVE Game Challenge

This week, I’ve decided to start a new VIVE challenge.  Each day, I’ll be creating a new Unity game developed specifically for the HTC VIVE.

I’ll spend a single day on each game (really about 4-6h of a day), creating the base gameplay and polishing up the experience a little.htc-vive-steam-vr-logo

After each game is complete, I’ll post the results here with a gameplay video and some thoughts on how it worked out.  I’ll also provide a download link for any current Vive owners to try it out and see how the experiences turn out.

 

Game 2 is ready now!

VIVE – Archery

The goal for this game was to build a semi-realistic archery simulator.  It didn’t quite turn out that way, but it’s still an interesting experiment.

Each round, you receive 10 arrows.  Your goal is to score as many points as you can by hitting both stationary and moving targets.

 

 

 

Result:

In my head, this was a lot more fun than it turned out to be.  I’ve learned that holding something in front of your head in VR doesn’t feel great.  I think the lack of peripheral vision may be the reason for this.  While it was a neat experiment, I think in the future, I’ll avoid games that have mechanics like this.

Bow & arrow pulling also turned out to be a little more time consuming than I initially expected.  While I could get the arrow to stick to the string pretty easily, making that look right and have proper limits wasn’t feasible in such a short time.  In the end, I went with making the bow play it’s normal pull animation when you touch the string and removing the restriction of holding the arrow in place.  So while in the video it may look like it’s being pulled back and released, you can just as easily tap the string and pull the arrow controller away.  I think the lack of a proper physical feedback mechanism (like a bow built for VR) makes this interaction just not quite work.

All that said, my wife somehow still enjoyed the game.  It was one of her recommendations, so perhaps that had some influence.  Or maybe I’m just not great at judging these, I’m not sure yet.

Implementation:

There are only a few components to this game.  The more advanced ones got pulled due to not working out (bow pulling)Scene View

As a side note, I do have a Giveaway going on right now for a $25 Asset Store voucher.  If you want to win, you can enter here.

Bow

This was an asset from the Asset Store for $5.  There’s also a free one available, but in the end I wanted the animation so I paid up.

 

It works by having a trigger on a box collider attached to the string.  When the trigger is entered by the right hand controller, I reload the arrow and play the animation.Archery - Hierarchy

Arrow

The arrow was pulled off the bow asset and the pivot point had to be fixed.  For some reason, many art assets in the store have strange offsets and pivots that make no sense, this followed that trend.  Once it was fixed though, I placed a simple arrow script and an audio source on the arrow.  The script has a single public Fire method that sets its’ parent to the root (initially the parent is the bow so it will track), then it adds some force in it’s forward direction.  Because the bow’s forward was a bit messed up, I threw in a quick hack of an extra gameObject named “DirectionalTransform” that I used to get the correct forward direction (this could have been done in max/maya too, but a lot of the time these little hacks are quicker for people who haven’t used them much before).

Archery - Bow InspectorArchery - Bow Inspector

Archery – Bow Inspector

They also check for collision and if they hit the ground or a target/box I set the isKinematic property to true on it’s rigidbody so it appears to stick into the target.  You may notice in the video that there’s a bug when she hits the moving targets.  I didn’t think to make the arrows become a child of the target, so they stay floating wherever they hit it.  I considered fixing this, but thought it was more interesting to discuss the issue than resolve it.

Boxes & Targets

Moving Target

Moving Target

These just have a trigger collider and a “Target” script.  The target script just watches for trigger enter events.  When they fire, it increments the score and plays a sound.

 

 

 

 

Up Tomorrow: Zombie Shooter