C# Класс KAS.KASModulePhysicChild

A module for a disconnected object that should be affected by the normal physics.
It's expected the object is somehow related to the part. If part gets destroyed then the physical child get destroyed as well.
Наследование: PartModule
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
StartPhysics ( GameObject physicObj, float mass, bool delayPhysics = false ) : void

Starts physics handling on the object.

The object is expected to not have rigidbody. The one will be added with the proper mass and velocity settings. Parent transform of the physics object will be set top null, and it will become an idependent object.

StopPhysics ( ) : void

Stops physics handling on the object.

Rigidbody on the object gets destroyed.

Приватные методы

Метод Описание
FixedUpdate ( ) : void

Overriden from MonoBehavior.

OnDestroy ( ) : void

Overriden from MonoBehavior.

OnPartPack ( ) : void

Part's message handler.

Temporarily suspends physics handling on the object.

OnPartUnpack ( ) : void

Part's message handler.

Resumes physics handling on the object.

WaitAndPromoteToPhysic ( ) : IEnumerator

Turns rigidbody to a physics object.

The update is delayed till the next fixed update to let game's physics to work. Once updated the physical object is guaranteed to be detached from the parent.

WaitAndUpdateVelocities ( ) : IEnumerator

Aligns position, rotation and velocity of the rigidbody.

The update is delayed till the next fixed update to let game's physics to work.

Описание методов

StartPhysics() публичный Метод

Starts physics handling on the object.
The object is expected to not have rigidbody. The one will be added with the proper mass and velocity settings. Parent transform of the physics object will be set top null, and it will become an idependent object.
public StartPhysics ( GameObject physicObj, float mass, bool delayPhysics = false ) : void
physicObj UnityEngine.GameObject Game object to attach physics to. In normal case it's never a part's /// gameobject.
mass float Mass of the rigidbody.
delayPhysics bool If default or false then new object gets parent's velocity /// immediately. Otherwise, the rigidbody is created as kinematic and velocity is sync'ed in the /// next FixedUpdate() call.
Результат void

StopPhysics() публичный Метод

Stops physics handling on the object.
Rigidbody on the object gets destroyed.
public StopPhysics ( ) : void
Результат void