Physics

[Last updated: 01/18/2019]

 

 

Creating Physics Settings

Physics settings are created by the Editor and compiled in the .physics3.json file.
See “How to Set Up Physics” for more information on how to set up physics.
For more information on outputting physics calculation settings files, please refer to “Exporting Data for Embedded Use”.

 

Class for physical operation

The physics calculations and their application to the model are performed by the CubismPhysics class.
By passing the data in the .physics3.json file to Native(C++) CubismPhysics::Create function or Web(TypeScript) CubismPhysics.create function,
an instance of the CubismPhysics class is created that reflects the physics calculation settings.

 

In this case, Gravity and Wind described in the .physics3.json file are
overridden by the variable _options of the CubismPhysics::Options structure in Native (C++) or the variable _options of the Option class in CubismPhysics.ts in Web (TypeScript).
This variable_options can be accessed with the Native(C++) CubismPhysics::GetOptions and CubismPhysics::SetOptions functions, as well as by the
CubismPhysics.getOptions and CubismPhysics.setOptions functions of the Web (TypeScript).

 

The values of Gravity and Wind to be overridden by the variable _options are as shown in the code below.

 

 

Application to model

The results of physics calculations can be applied to model parameters with the Native (C++) CubismPhysics::Evaluate function or the Web (TypeScript) CubismPhysics.evaluate function.
At this time, physics calculations are also performed at the same time.

 

 

Discard

The CubismPhysics class must also be destroyed when the model is released.

© 2010 - 2022 Live2D Inc.