• Basic Virtual Reality Meta XR assignment with requirements:
    • Objects in the scene that can be interacted with
    • A custom component that uses the Update or FixedUpdate lifecycle function
    • A custom component that integrates with an Interactor Event or Collision Event
    • Use of the physics system and/or collision detection

learnings

  • Decided to make a punching bag that you can hit
  • Could not figure out where to add collider/rigidbody to the hands with meta building blocks??? So I made a gun that shoots bullets following this tutorial lmao and then shot at the punching bag…
    • grabbable cylinder for gun
    • sphere for bullet
    • capsule with Joint for punching bag
  • Utilized Collider events - OnCollisionEnter - OnCollisionExit
  • Created empty GameObject for bullet spawn point, and bullet prefab that gets Instantiate
    • Each bullet uses Destroy to destroy after a set period of time
    • var bullet = Instantiate(bulletPrefab, BulletSpawnPoint.position, BulletSpawnPoint.rotation);
    • Destroy(gameObject, life); `

Useful functions

  • can get GameObject by various fields such as its name or tag
    • collision.gameObject.name