Throw an object with collision against the world
- A particle system is parented to the reset target, which emits particles as it moves.
- When the system is enabled, these particles hit the Force Collider, which adds force to the Rigidbody.
- This Rigidbody then flies forward as if thrown, and collides with the world using the Collision Collider.
- Meanwhile, Contact Senders and Receivers, in combination with Constraints, are used to figure out the position of the thrown object, and this is synced to the remote client (since parameter force is local only).
- This remote sync is not incredibly accurate to not spend too many bits on it: 25m from where you throw, with 0.2m precision, so landing location might differ slightly between local and remote.
- If you want rotation sync, install the components from the Rotation-Synced directory.
2024-04-03.22-56-12-1.mp4
- Merge the Animator Controller
Rigidbody Throw FX
to your own FX Controller, using the Avatars 3.0 Manager tool. - Merge the Expression Parameter List
Rigidbody Throw Parameters
to your own Expression Parameter List, using the Avatars 3.0 Manager tool. - Drag & drop the
Rigidbody Throw
prefab into the base of your Hierarchy. - Right click and unpack the prefab, then drag & drop it onto your avatar.
- Move
Reset Target
outside ofRigidbody Throw/Throw
and place it anywhere in your avatar's hierarchy. Adjust the transforms as needed.
- Place the objects you want to to use inside
Rigidbody Throw
->Throw
->Container
.- Alternatively you can constrain the objects to
Container
.
- Alternatively you can constrain the objects to
- Your right hand gesture must be 2 (HandOpen) for the system to release, and 1 (Fist) to reset.
- To change the friction and the bounciness, change the parameters on the
Resources/Physics Material
Physics Material and apply that Physics Material to your Collision Collider. - To have a custom throwing/reset condition, change the
GestureRight Equals 1 or 2
conditions in theRigidbody Throw Main
layer. - To change world collision, only use Colliders on the
Collision Collider
object. This can be a Box Collider, Sphere Collider, Capsule Collider, but it has to be on theCollision Collider
object.
Default version:
Colliders: 2
Constraints: 10
Contact Receivers: 4
Contact Senders: 2
FX Animator Layers: 4
Particle Systems: 2
Rigidbodies: 2
Joints: 1
Expression Parameters: 27
Rotation synced version:
Colliders: 2
Constraints: 14
Contact Receivers: 4
Contact Senders: 2
FX Animator Layers: 4
Particle Systems: 2
PhysBones: 6
PhysBone Colliders: 3
Rigidbodies: 2
Joints: 1
Expression Parameters: 51
Default version:
Rigidbody Throw
|-Throw
| |-Reset Target
| |-Force Particle
| |-Container
| | |-Colliders
| | | |-Force Collider
| | | |-Colission Collider
| | | |-Collision Detection
| | |-Example Sphere
| |-Quick Position Sync
| | |-Position Sync
| | | |-Contacts
| | | | |-Sender
| | | | |-Receiver X
| | | | |-Receiver Y
| | | | |-Receiver Z
| | | |-Local Target
| | | |-Remote Target
Rotation synced version:
Rigidbody Throw
|-Throw
| |-Reset Target
| |-Force Particle
| |-Container
| | |-Colliders
| | | |-Force Collider
| | | |-Colission Collider
| | | |-Collision Detection
| | |-Example Cube
| |-Quick Position Sync
| | |-Position Sync
| | | |-Contacts
| | | | |-Sender
| | | | |-Receiver X
| | | | |-Receiver Y
| | | | |-Receiver Z
| | | |-Local Target
| | | |-Remote Target
| | |-Rotation Sync
| | | |-Measure Bones
| | | | |-Measure X Magnitude
| | | | |-Measure X Sign
| | | | |-Measure Y Magnitude
| | | | |-Measure Y Sign
| | | | |-Measure Z Magnitude
| | | | |-Measure Z Sign
| | | |-Measure Planes
| | | | |-X Angle Plane
| | | | |-Y Angle Plane
| | | | |-Z Angle Plane
Rigidbody Throw is available as-is under MIT. For more information see LICENSE.