Creating a Grabbable Physics Object

Setting up your first object

  1. Select any GameObject and make sure it has these components and features to work correctly:

    1. Layer: Grabbable

    2. Add: RIgidbody

    3. Add: Box Collider

    4. Add: Grabbable Object script

  2. You can additional add functionality for impact sounds

    1. Add: Impact Sound

    2. Add: Audio Event Player (If you want to use 3D sounds on the object - Set the spatial blend to the automatically attached audio source to 3D)

Best Rigidbody Settings

Setting
Explanation

Mass

Leave this on the default value as you can set this within the GrabbableObject script

Drag

Adjust as you'd like

Angular Drag

Adjust as you'd like

Use Gravity

Keep ticked as most physics objects will require this

GrabbableObject Script Explained

Setting
Explanation

Weight

Setting this will adjust the mass of the attached rigidbody

Can Rotate

Whether you can rotate this object when holding it

Can Throw

Can this object be thrown?

Min / Max Throw Force

The value that will force the object to be thrown when holding the throw press

Ignore Mass On Throw

Tick this if you want to throw the object without taking it's mass into account (Think a power throw)

Can Push

Tick this if you want to be able to do the force push style mechanic

Push Force

How much force will be used to push the object

Grab Pivot

This can be an empty GameObject at the position you can the objects pivot to be - Very useful if the model you're using does have a good pivot location

Audio Section

All of these share the same format.

  • Clip: Add the audio clip you'd like here

  • Volume: Volume of the audio clip

  • Pitch: The default pitch of the clip

  • Random Pitch Range: Set this so each time the sound effect is played, it will sound slightly different

Audio Player

Add the AudioPlayer componet here, this can either be one you might have on your object or a global one within the scene

Events

If you want something specific to happen on those motions, additional VFX, sounds or whatever is suitable for your purposes

Impact Sound Script Explained

Audio Player

Add the audio player here, whether there is one attached to this GameObject or a global one.

Impact Clip

Same settings as above

Min Impact Speed

The speed at which the object has to be moving for impact sounds to happen, the lower the more sensitive

Surface Layers

Add layers where the sounds should happen

Ignore Layer Mask

Ignore the layer mask if you want impact sounds to happen on every single collision

Last updated