Struct PhysicsJobOptions2D

Source
pub struct PhysicsJobOptions2D {
Show 19 fields pub m_ClearBodyForcesPerJob: i32, pub m_ClearFlagsPerJob: i32, pub m_CollideContactsPerJob: i32, pub m_FindNearestContactsPerJob: i32, pub m_InterpolationPosesPerJob: i32, pub m_IslandSolverBodiesPerJob: i32, pub m_IslandSolverBodyCostScale: i32, pub m_IslandSolverContactCostScale: i32, pub m_IslandSolverContactsPerJob: i32, pub m_IslandSolverCostThreshold: i32, pub m_IslandSolverJointCostScale: i32, pub m_NewContactsPerJob: i32, pub m_SyncContinuousFixturesPerJob: i32, pub m_SyncDiscreteFixturesPerJob: i32, pub m_UpdateTriggerContactsPerJob: i32, pub m_UseConsistencySorting: Option<bool>, pub m_UseMultithreading: Option<bool>, pub useConsistencySorting: Option<bool>, pub useMultithreading: Option<bool>,
}
Expand description

PhysicsJobOptions2D is a sub class of the Unity engine since version 2018.1.0b2. Exert from Unity’s scripting documentation: A set of options that control how physics operates when using the job system to multithread the physics simulation. Multithreaded physics is currently an experimental feature. As such, many options are exposed that allow performance configuration that may not be available when the feature moves out of experimental status.A physics simulation executes in the following discrete stages:• Find New Contacts • Contact Collision • Discrete Solver (Clear Island Flags -> Discrete Island Traversal -> Discrete Island Solver -> Synchronize Fixtures -> Find New Contacts) • Continuous Solver (Clear Island Flags > Continuous Island Traversal -> Discrete Island Solver -> Synchronize Fixtures -> Find New Contacts) • Clear Body Forces • Update Trigger ContactsThese stages execute in the order given above. Each stage is run as a job “task”. Each task executes sub job tasks, which are shown in parenthesis above. When executing a job, physics simulation may process bodies, contacts, joints, and so on, across multiple job threads. You can task each of these threads with executing a specific number of items, such as bodies, contacts and joints. Many of the options provided here allow you to control the minimum number of items assigned to each job. Raising the minimum can reduce the number of jobs required. This is because running a lot of jobs, each processing only a few items, is usually not very efficient. The default settings provide a decent performance to job balance, however you are free to experiment.Additionally, prior to the simulation being run, Rigidbody2D interpolation/extrapolation poses are stored ready for per-frame interpolation/extrapolation. These are also executed using the job system and are controlled here.

Fields§

§m_ClearBodyForcesPerJob: i32

Controls the minimum number of bodies to be cleared in each simulation job.

§m_ClearFlagsPerJob: i32

Controls the minimum number of flags to be cleared in each simulation job.

§m_CollideContactsPerJob: i32

Controls the minimum number of contacts to collide in each simulation job.

§m_FindNearestContactsPerJob: i32

Controls the minimum number of nearest contacts to find in each simulation job.

§m_InterpolationPosesPerJob: i32

Controls the minimum number of Rigidbody2D being interpolated in each simulation job.

§m_IslandSolverBodiesPerJob: i32

Controls the minimum number of bodies to solve in each simulation job when performing island solving.

§m_IslandSolverBodyCostScale: i32

Scales the cost of each body during discrete island solving.

§m_IslandSolverContactCostScale: i32

Scales the cost of each contact during discrete island solving.

§m_IslandSolverContactsPerJob: i32

Controls the minimum number of contacts to solve in each simulation job when performing island solving.

§m_IslandSolverCostThreshold: i32

The minimum threshold cost of all bodies, contacts and joints in an island during discrete island solving.

§m_IslandSolverJointCostScale: i32

Scales the cost of each joint during discrete island solving.

§m_NewContactsPerJob: i32

Controls the minimum number of new contacts to find in each simulation job.

§m_SyncContinuousFixturesPerJob: i32

Controls the minimum number of fixtures to synchronize in the broadphase during continuous island solving in each simulation job.

§m_SyncDiscreteFixturesPerJob: i32

Controls the minimum number of fixtures to synchronize in the broadphase during discrete island solving in each simulation job.

§m_UpdateTriggerContactsPerJob: i32

Controls the minimum number of trigger contacts to update in each simulation job.

§m_UseConsistencySorting: Option<bool>

Should physics simulation sort multi-threaded results to maintain processing order consistency? bool: (2018.1.0b2 - 2018.1.0b10)

§m_UseMultithreading: Option<bool>

Should physics simulation use multithreading? bool: (2018.1.0b2 - 2018.1.0b10)

§useConsistencySorting: Option<bool>

Should physics simulation sort multi-threaded results to maintain processing order consistency? bool: (2018.1.0f2 - 2022.3.2f1)

§useMultithreading: Option<bool>

Should physics simulation use multithreading? bool: (2018.1.0f2 - 2022.3.2f1)

Trait Implementations§

Source§

impl Debug for PhysicsJobOptions2D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PhysicsJobOptions2D

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PhysicsJobOptions2D

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,