Git Product home page Git Product logo

rigidbody-throw's Introduction

Rigidbody Throw

Generic badge Generic badge Generic badge Generic badge

Generic badge Generic badge

Throw an object with collision against the world

Rigidbody Throw


How it works

  • 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.

Install guide

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 of Rigidbody Throw/Throw and place it anywhere in your avatar's hierarchy. Adjust the transforms as needed.

How to use

  • Place the objects you want to to use inside Rigidbody Throw -> Throw -> Container.
    • Alternatively you can constrain the objects to Container.
  • 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 the Rigidbody 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 the Collision Collider object.

Performance stats

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

Hierarchy layout

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

Contributors

License

Rigidbody Throw is available as-is under MIT. For more information see LICENSE.

rigidbody-throw's People

Contributors

jellejurre avatar hfcred avatar jetees avatar cibbi avatar wingmandraws avatar

Stargazers

 avatar  avatar Joacoco avatar Nopied◎ avatar Kyle Flores avatar Yoratski avatar

Watchers

PF_Cactus avatar  avatar rero avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.