/Selective-Animation

System for playing animations for only a single player in an instance

Primary LanguageC#MIT LicenseMIT

Selective Animation

Generic badge Generic badge Generic badge Generic badge

Generic badge Generic badge

System for playing animations for only a single player in an instance

SelectiveAnimation


How it works

  • The system is built using two Raycasts.
  • The two raycasts are slightly offset from each other, and one has a contact sender on it, while the other a contact receiver on it.
  • When pointed at a player, both raycasts will collide with the player only on their screen, because the PlayerLocal collider only exists on their side. This means the Contact Sender and Receiver will only make contact for the player the system is pointing at.

Install guide

2023-10-04.00-18-05-1.mp4
  • If you dont already have Final IK installed, download and install the Final IK Stub.
    • Note: Testing in Unity is not possible when using the Final IK Stub!
  • Drag & drop the Selective Animation prefab into the base of your Hierarchy.
  • Right click and unpack the prefab, then drag & drop it onto your avatar.
  • Expand the prefab hierarchy and find Selective Animation Target
  • Move Selective Animation Target outside of Selective Animation and place it anywhere in your avatars hierarchy as needed.
  • Adjust the rotation so the laser points in the desired direction.
  • The laser can be disabled or deleted.

How to use

  • Add the bool SelectiveAnimation/IsSelected to your FX controller.
  • When the system is pointing at a player, the bool will be True only for the player it is pointing at.
  • Use the bool as a transition condition to make animations visible to only the one player.

Additional notes

  • VRChat uses Final IK v1.9. If you are using a different version you may experience differences in behavior when testing with Final IK.

Performance stats

Constraints:        3
Contact Receivers:  1
Contact Senders:    1

Hierarchy layout

Selective Animation
|-Raycast Container
|  |-PlayerLocal Raycast Sender
|  |  |-LimbIK
|  |  |  |-Grounder
|  |  |  |  |-Offset
|  |  |  |  |  |-End
|  |-PlayerLocal Raycast Receiver
|  |  |-LimbIK
|  |  |  |-Grounder
|  |  |  |  |-Offset
|  |  |  |  |  |-End
|  |-Sender
|  |-Receiver
|  |-Laser
|-Selective Animation Target

Contributors

License

Selective Animation is available as-is under MIT. For more information see LICENSE