As an Associate of Unity Asset Store, this website earns from qualifying purchases and contains affiliate links: check the footer for more info.

Throw Object 3D: Mobile, Desktop, FPS — Top Unity Asset

Throw Object 3D (Unity Asset) — highly customizable Advanced Throwing System for Unity. You can throw object forward or in any direction with custom force, a center of mass, and 80+ other throwing parameters. 2 Modes. 2 Demos. 10 Throwing Objects.

Features of Throw Object 3D

All modules are designed independently to keep the Unity Asset extendable & easy to understand:

Package Contains

Check the Map of Unity Assets to choose the product that best suits your needs.

Package is a Part of Unity Assets

Football (docs).


Basketball Game (docs).


AR Throw & Score (docs).


AR Throwing (docs).


AR Basketball (docs).

Use Cases


Throwing System: 80+ Customizable Parameters

Throwing System consists of 4 control scripts that are completely customized already in Demo Scenes.

1. Random Object Pooler

RandomObjectPooler.cs — independent script: Object Pool, performance optimization technique through Objects Reusing. It’s used by ThrowControl.cs. All Throwing Objects are created at the Scene Start from prefabs and used throughout the Scene Session.

Parameters

Prefabs

Prefabs of Throwing Objects are set in Unity Editor by default.

If you have dynamic gameplay & you need to change prefabs programmatically before initialization outside the Throwing System, use the next functions of ThrowControl.cs (AR Basketball (docs) uses such function due to different ball prefabs for different AR Engines: AR Foundation & AR Camera Lite (docs)):

Single Prefab
Multiple Prefabs
Events

2. Throw Control

ThrowControl.cs — main script that manages the Throw & all Throwing Objects on a scene through Object Pool. The script uses disabling and enabling the following nodes: Colliders, Triggers, Renderers.

To Get the Count of Throwing Objects, use GetObjectCount() function.

Modes

The higher the last position of the mouse cursor (or finger) during the click (or tap), the greater the strength of the throw. Throwing System completely works on Desktop as well as on Mobiles.

Click Or Tap

In this mode, the Game Object is thrown in the direction of the click (desktop) or tap (mobile).

FPS

For the FPS game, there is an option for fixing the input position in a specific place on the screen (by default in the center of the screen). FPS Desktop Demo uses CharacterController (Throw force takes into account the speed of the player’s movement).

Flick

In this mode, you can throw object in the style of the Pokemon GO game (iOS, Android) (by flicking it from the bottom of the screen up toward the target).

Is Full Path For Flick?

If it’s false then it allows fast flicks only: positions in the last and previous frames are taken into account.

Work Scheme

  1. Initialize Object Pool,
  2. Initialize Throwing Objects,
  3. Get First Throw (Start the Throwing Cycle):
    1. Get Next Throw,
    2. Fade In,
    3. Throw,
    4. Fade Out,
    5. Reset.

Events

Coroutines

The only script that starts coroutines. Because of coroutines behavior, it’s impossible to place some methods inside ThrowingObject.cs. OOP doesn’t work in this case, but we have a stable throwing with Object Pool.

3. Throwing Object

ThrowingObject.cs — script that contains basic functions and parameters to operate Throwing Object.
This script must be attached to each Throwing Prefab (check tutorial).

Events

Parameters

Colliders

Rotation (Torque) & Center of Mass

There are some nuances with Rigidbody.centerOfMass when rotation.

Symmetric Mesh

If you use Mesh Collider for Throwing Game Object and your mesh is ideally symmetric, then it’s the perfect case and the game object will throw naturally.

Asymmetric Mesh

If you use Mesh Collider for Throwing Game Object and your mesh is asymmetric, then you will have unnatural throw behavior when rotation.

Solutions:

1. Custom Center of Mass. You can indicate Custom Center of Mass manually in the Editor. Unity Package contains some examples with Custom Center of Mass and Tools for Debugging it Visually (you can also turn on the Gizmos in the Game view to facilitate the debugging). There is no magic function that calculates the right Center of Mass.

2. Simple Forms of Colliders. You need to use one or more simple forms of colliders (box, sphere, etc.) placing them on the same Throwing Game Object and along the straight line. So in this case, you will have the right center of mass & right rotation.

Convex Mesh

Unity allows you to use only convex mesh colliders. In some cases, it is not what you need because the collider by default can cover more space than the object itself in some points. In order to quickly & automatically get a convex mesh collider for complex objects, use Technie Collider Creator.

4. Material Control

MaterialControl.cs — an independent script that implements Fading (Dissolving) VFX for Throwing Objects: it’s used by ThrowingObject.cs. You can use it for Fading outside Throwing System (Examples: Ring, Ring Holder, Net, Backboard, Pole in AR Basketball (docs) & Basketball Game (docs)).

Here you can control Fading In & Fading Out with Full Control of Value, Delay, Time & Speed for Indicated Shader Parameter. Actually, you can change any Float Parameter in the shader over time.

Default Materials for Throwing Object is still placed in the Mesh Renderer component.

Parameters

Shaders

There are 3 Custom Shaders with “Slice Guide” Texture for Fading of Game Object and its Shadow.
Check [Your Material] > Shader > Custom > Makaka Games:

Tutorial

This tutorial is relevant for Throw Object 3D 5.2+.
Tutorial for the previous version can be found only in the asset folder.

Getting Started with Throw Object 3D

Folders & Files in the package by default:

Steps

If you have any issues with the first launch then just Reach Support with Invoice Number and Get Help.

If you read this tutorial from PDF, first check the latest docs online to get actual information.

  1. Create New Unity Project with Unity 2021.3.4 & “3D” Template.
  2. File > Build Settings > iOS, Android, Standalone (PC, Mac) or WebGL > Switch Platform.
  3. Download and import Throw Object 3D into Unity.
    1. Warning Windows:
      1. Click “Import” to overwrite the Project Settings with predefined ones.
      2. Click “Install/Upgrade” for Package Manager Dependencies.
  4. Next Packages are provided with Unity Package Manager, and they are already installed for this Asset by default. If packages are missing (Warning Window did not appear) then install them again with Unity Package Manager (with advanced settings enabled: “Pre-release Packages” & “Show Dependencies”):
    1. TextMesh Pro 3.0.6:
      1. Always Required: Window > TextMeshPro > Import TMP Essential Resources.
  5. Reopen Unity Project.
  6. Open Scene: Makaka Games > Throw Object 3D > Scenes > Demo.
  7. Test in the Unity Editor or Build for Mobile or Desktop.

Creating your own Throwing Object Prefab

  1. Create Prefab with a template:
    1. Drag one of the customized Throwing Object prefabs from the Project window into the Scene view,
    2. Name your Game Object,
    3. Drag the named Game Object into the Project window to create the Original Prefab.
  2. Select the Game Object on the Scene & Customize it:
    1. Indicate Mesh of your 3D Model in Mesh Filter component,
    2. Customize Material in Mesh Renderer component (duplicate previous Material in the Project window and indicate here to separate different Throwing Objects),
    3. Customize Fading in Material Control component,
    4. Customize Colliders:
      1. Indicate Mesh in Mesh Collider component (or in more suitable collider component);
    5. Option: Customize the Center of Mass for more natural Throwing.
  3. Customize the Transform component as you wish.
  4. Apply Changes to Prefab.
  5. Delete Game Object from Scene.
  6. Option: Add Asset Label (ThrowingObject) for Prefab for convenient searching in the Project window.
  7. Add Prefab to Random Object Pooler component of ThrowingPoolControl Game Object.
  8. Throw Object Forward in “Play Mode”.

How to Keep Game Objects in Scene after the Throwing?

Here is the result video after applying manipulations in this section.

By default, Throwing Objects are not destroyed during the game due to Object Pool pattern with Object Reusing. Initially, the system is designed so that objects disappear after a certain time to save your device’s memory. Note that objects in pool are instantiated in advance, before you can click start button.

You can achieve the desired result by setting a large number of objects in the pool and a large reset delay, while disabling the fading:

  1. Target Throwing Object prefab > Material Control component > Is Parameter Changing On At Start > Uncheck (we are disabling the fading here).
  2. ThrowingPoolControl Game Object on Scene:
    1. Random Object Pooler component > Init Pooled Amount (set to target amount of objects in pool, e.g. 99);
    2. Throw Control component > Reset Delay (set to target amount of seconds: 999).

The system is designed with the Object Pool pattern, so you can’t set these values in inspector to protect you from too large values, long loading at start & low performance of your game, but you can fix the restrictions inside the script in field attributes.

Testing

You can quickly test in Unity Editor or with Unity Remote.

WebGL

Learn the Article called WebGL and Unity about Building and Testing Unity games and apps for WebGL.

Tested with Platforms

  1. Mobile Platforms:
    • iOS on iPhone 8, XS Max;
    • Android on Samsung Galaxy A71;
    • WebGL (Android) in Google Chrome.
  2. Desktop Platforms:
    • Windows;
    • macOS;
    • WebGL in Google Chrome.

Support

First, read the latest docs online.
If it didn’t help, get the support.

Changelog

Check the current version of Throw Object 3D on Asset Store.
The latest versions will be added as soon as possible.

5.2:

Features:

Improvements:

5.1:

Improvements:

5.0:

Features:

Improvements:

4.4:

4.3:

4.2:

4.1:

4.0:

This version adds performance improvements by more effective handling of materials, shaders, fading & caching, so it’s incompatible with previous versions of Asset.

3.17:

3.16 (Bug Fixing):

3.15:

3.14:

3.13:

3.12:

3.7:

3.6:

3.4 (Layer Changing in Throw Control):

Actual for quick Throwing to neutralize mutual collisions.

3.3 (Throw Customizations in Throw Control):

3.2 (“Flick” Mode Customizations in Throw Control):

3.1:

3.0 (New Architecture: Throw Control):

Main Control Script (Throw Control) operates Object Pool & All Throwing Objects now (Throwing Object Script is attached to each Throwing Object prefab).

Work Scheme:

  1. Initialize Pool,
  2. Initialize Throwing Objects,
  3. Get the First Throw,
  4. Get Next Throw.

2.6 (Rotation Customizations):

2.5:

2.4 (Center of Mass Customizations):

2.3 (Torque Customizations):

2.2 (Force Customization):

2.1:

2.0 (Object Pool — Throwing of Multiple Objects):

1.3 (Dynamic Sound System):

Sound System depending on Speed of Throwing Object.

1.2 (Fade Out option for Thrown Objects):

1.1:

1.0 (“Flick” Throwing Mode for Mobiles):

Exit mobile version