WeaponReloadVR Save Abandoned

Weapons Reload Mechanics for VR | Unity3d ( NewtonVR & SteamVR)

Project README

Showcase

showcase

How to use it ( PistolController.cs ).

  1. Download NVR and SteamVR assets from AssetStore.

  2. Then put on scene NVRPlayer Prefab ( camera rig ).
    Prefab

  3. Install NewtonVR by pressing "Enable SteamVR" in NVRPlayer prefab.
    install

  4. Inside NVRPlayer(camera rig), select both hands add "SteamVR_TrackedController component(script).
    install

5)Now You need a gun with separate slider.
gun

6)Add Rigidbody and NVRInteractableItem components to the gun.
gun

  1. Add all neccessary colliders for the all pistols parts, but do not add colliders on slider yet!
    gun

  2. Create empty gameobject and name it "Relative Point". Set on on the Slider height.
    gun

  3. Now make two child colliders inside the slider. First one name "Slider Collider", and second one make a bit bigger and name "Slider Trigger"
    gun

  4. "Slider trigger" set as trigger.
    gun

  5. After that, to the "Slider trigger" add "Pistol Controller" component.
    gun

  6. Finally set all neccessary variables:
    -12.1 Current Object Item - set your gun itself.
    -12.2 Relative Point - set your empty gameobject called "Relative point" which we created on the step 8.
    -12.3 This gun Slider - add guns Slider gameobject.
    gun

Done! Pistol is ready!

Sniper Bolt Controller (sniperBoltController.cs):

All procedure is 80% same as with pistol, but for bolt action we need more movements and different sequence. So to simplify it for now, I decided to make it using animations.

  1. You need to add animator controller to the slider (bolt), and record 3 animations: boltIdle, BoltRotate, boltSlide. Each animation is should be 1 frame length, cuz transition will be automatic.
    boltIdle - is just an idle animation. BoltRotate - is 55 degree rotate animation. boltSlide - is the Z axis move animation.

  2. In animator controller you need to add 2 float parametrs: BoltRotate, BoltSlide.
    gun

  3. Then add first blend tree and add 2 motions ( boltIdle and BoltRotate) and one another blendtree in "Motion" section. All blending should depend from "BoltRotate" parameter, and set threshold as on screenShot:
    gun

  4. In second blend tree add 2 motions: (BoltRotate and boltSlide(I have mistake in animation name - blotSlide :D)) and make them blend under "BoltSlide" parameter.
    gun

That's how it's might look like:
gun

So, That's it!
All contributions are welcome :)

Open Source Agenda is not affiliated with "WeaponReloadVR" Project. README Source: Oyshoboy/weaponReloadVR
Stars
27
Open Issues
0
Last Commit
6 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating