Sprite Factory

ReadMe
Release Notes
Overview
Using the Editor
Upgrading

Concepts
Sprites
Master Sprites
Sprite Groups
Colliders
Locators
Material Sets
SpriteUpdater
SpriteCamera

Advanced
Working in Multiple Projects

Classes
Runtime Classes

Videos
Overview
Creating Sprites
Sprite Inspector
Frame Events
Collision System
Locator System
Material Sets

Links
Sprite Factory Site
Web Documentation
Support
Contact

SpriteFactory.RigidbodyInfo.GetRigidbody

C#: TRigidbody GetRigidbody<TRigidbody> ()
JS: function GetRigidbody.<TRigidbody> () : TRigidbody

Description
Generic function. Get the rigidbody cast to a specific type. TRigidbody must be derrived from either Rigidbody or Rigidbody2D.

Example:

C#

RigidbodyInfo rigidbodyInfo = sprite.GetRigidbody("HitCollider"); // get the rigidbody from the sprite
if(rigidbodyInfo.is2D) { // this is a 2D rigidbody
    Rigidbody2D rb2D = rigidbodyInfo.GetCollider<Rigidbody2D>(); // get the rigidbody cast to the proper type
    // do something
} else { // this is a 3D rigidbody
    Rigidbody rb = rigidbodyInfo.GetCollider<Rigidbody>(); // get the rigidbody cast to the proper type
    // do something
}