Obi  7.0.5
Unified particle physics for Unity
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Obi.ObiRod Class Reference
Inheritance diagram for Obi.ObiRod:
Obi.ObiRopeBase Obi.IStretchShearConstraintsUser Obi.IBendTwistConstraintsUser Obi.IChainConstraintsUser Obi.ObiActor Obi.IAerodynamicConstraintsUser Obi.IObiParticleCollection

Public Member Functions

override void RequestReadback ()
 
override void SimulationEnd (float simulatedTime, float substepTime)
 
Vector3 GetBendTwistCompliance (ObiBendTwistConstraintsBatch batch, int constraintIndex)
 
Vector2 GetBendTwistPlasticity (ObiBendTwistConstraintsBatch batch, int constraintIndex)
 
Vector3 GetStretchShearCompliance (ObiStretchShearConstraintsBatch batch, int constraintIndex)
 
- Public Member Functions inherited from Obi.ObiRopeBase
float GetDrag (ObiAerodynamicConstraintsBatch batch, int constraintIndex)
 
float GetLift (ObiAerodynamicConstraintsBatch batch, int constraintIndex)
 
override void ProvideDeformableEdges (ObiNativeIntList deformableEdges)
 
override int GetDeformableEdgeCount ()
 
float CalculateLength ()
 Calculates and returns current rope length, including stretching/compression. More...
 
void RecalculateRestLength ()
 Recalculates the rope's rest length, that is, its length as specified by the blueprint. More...
 
void RecalculateRestPositions ()
 Recalculates all particle rest positions, used when filtering self-collisions. More...
 
void RebuildElementsFromConstraints ()
 Regenerates all rope elements using constraints. It's the opposite of RebuildConstraintsFromElements(). This is automatically called when loading a blueprint, but should also be called when manually altering rope constraints (adding/removing/updating constraints and/or batches). More...
 
virtual void RebuildConstraintsFromElements ()
 Regenerates all rope constraints using rope elements. It's the opposite of RebuildElementsFromConstraints().This should be called anytime the element representation of the rope is changed (adding/removing/updating elements). This is usually the case after tearing the rope or changing its length using a cursor. More...
 
ObiStructuralElement GetElementAt (float mu, out float elementMu)
 Returns a rope element that contains a length-normalized coordinate. It will also return the length-normalized coordinate within the element. More...
 
int GetEdgeAt (float mu, out float elementMu)
 Returns index of the edge that contains a length-normalized coordinate. It will also return the length-normalized coordinate within the edge. More...
 
- Public Member Functions inherited from Obi.ObiActor
delegate void ActorCallback (ObiActor actor)
 
delegate void ActorStepCallback (ObiActor actor, float simulatedTime, float substepTime)
 
delegate void ActorBlueprintCallback (ObiActor actor, ObiActorBlueprint blueprint)
 
void AddToSolver ()
 Adds this actor to its solver, if any. Automatically called by ObiSolver. More...
 
void RemoveFromSolver ()
 Remove this actor from its solver, if any. Automatically called by ObiSolver. More...
 
virtual void ProvideDeformableTriangles (ObiNativeIntList deformableTriangles, ObiNativeVector2List deformableUVs)
 
virtual bool CopyParticle (int actorSourceIndex, int actorDestIndex)
 Copies all data (position, velocity, phase, etc) from one particle to another one. More...
 
void TeleportParticle (int actorIndex, Vector3 position)
 Teleports one actor particle to a certain position in solver space. More...
 
virtual Matrix4x4 Teleport (Vector3 position, Quaternion rotation)
 Teleports the entire actor to a new location / orientation. More...
 
virtual bool ActivateParticle ()
 Activates one particle. More...
 
virtual bool DeactivateParticle (int actorIndex)
 Deactivates one particle. More...
 
virtual bool IsParticleActive (int actorIndex)
 Returns whether a given particle is active. More...
 
virtual void SetSelfCollisions (bool selfCollisions)
 Updates particle phases in the solver at runtime, including or removing the self-collision flag. More...
 
virtual void SetOneSided (bool oneSided)
 Updates particle phases in the solver at runtime, including or removing the one-sided flag. More...
 
void SetSimplicesDirty ()
 Marks simplices dirty. More...
 
void SetConstraintsDirty (Oni.ConstraintType constraintType)
 Marks a given constraint type as dirty. More...
 
void SetRenderingDirty (Oni.RenderingSystemType rendererType)
 Marks rendering dirty. More...
 
IObiConstraints GetConstraintsByType (Oni.ConstraintType type)
 Returns the data representation of constraints of a given type being simulated by this solver. More...
 
virtual void UpdateParticleProperties ()
 Call when some particle properties have been modified and need updating. More...
 
int GetParticleRuntimeIndex (int actorIndex)
 Returns the index of this particle in the solver arrays. More...
 
Vector3 GetParticlePosition (int solverIndex)
 Given a solver particle index, returns the position of that particle in world space. More...
 
Quaternion GetParticleOrientation (int solverIndex)
 Given a solver particle index, returns the orientation of that particle in world space. More...
 
Vector3 GetParticleRestPosition (int solverIndex)
 Given a solver particle index, returns the rest position of that particle. More...
 
Quaternion GetParticleRestOrientation (int solverIndex)
 Given a solver particle index, returns the rest orientation of that particle. More...
 
void GetParticleAnisotropy (int solverIndex, ref Vector4 b1, ref Vector4 b2, ref Vector4 b3)
 Given a solver particle index, returns the anisotropic frame of that particle in world space. More...
 
float GetParticleMaxRadius (int solverIndex)
 Given a solver particle index, returns the maximum world space radius of that particle, in any axis. More...
 
Color GetParticleColor (int solverIndex)
 Given a solver particle index, returns the color of that particle. More...
 
void SetFilterCategory (int newCategory)
 Sets a given category value for all particles in the actor. More...
 
void SetFilterMask (int newMask)
 Sets a given mask value for all particles in the actor. More...
 
void SetMass (float mass)
 Sets the inverse mass of each particle so that the total actor mass matches the one passed by parameter. More...
 
float GetMass (out Vector3 com)
 Returns the actor's mass (sum of all particle masses), and the position of its center of mass. More...
 
void AddForce (Vector3 force, ForceMode forceMode)
 Adds an external force to all particles in the actor. More...
 
void AddTorque (Vector3 force, ForceMode forceMode)
 Adds a torque to the actor. More...
 
void ResetParticles ()
 Resets the position and velocity of all particles, to the values stored in the blueprint. More...
 
bool SaveStateToBlueprint (ObiActorBlueprint bp)
 Resets the position and velocity of all particles, to the values stored in the blueprint. More...
 
void ClearState ()
 
virtual void SimulationStart (float timeToSimulate, float substepTime)
 
virtual void Interpolate (float simulatedTime, float substepTime)
 
virtual void OnSolverVisibilityChanged (bool visible)
 

Protected Member Functions

override void OnValidate ()
 
override void RebuildElementsFromConstraintsInternal ()
 
- Protected Member Functions inherited from Obi.ObiActor
virtual void Awake ()
 
virtual void OnDestroy ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
void SetSolver (ObiSolver newSolver)
 Forcibly changes the solver in charge of this actor More...
 
void SetMassScale (float scale)
 Sets the mass of all particles in the actor to their blueprint values, multiplied by a scale factor. More...
 
virtual void OnBlueprintRegenerate (ObiActorBlueprint blueprint)
 
void UpdateCollisionMaterials ()
 
virtual void SwapWithFirstInactiveParticle (int actorIndex)
 
void StoreState ()
 

Protected Attributes

ObiRodBlueprint m_RodBlueprint
 
bool _stretchShearConstraintsEnabled = true
 
float _stretchCompliance = 0
 
float _shear1Compliance = 0
 
float _shear2Compliance = 0
 
bool _bendTwistConstraintsEnabled = true
 
float _torsionCompliance = 0
 
float _bend1Compliance = 0
 
float _bend2Compliance = 0
 
float _plasticYield = 0
 
float _plasticCreep = 0
 
bool _chainConstraintsEnabled = true
 
float _tightness = 1
 
- Protected Attributes inherited from Obi.ObiRopeBase
bool m_SelfCollisions = false
 
float restLength_ = 0
 
bool _aerodynamicsEnabled = true
 
float _drag = 0.05f
 
float _lift = 0.02f
 
- Protected Attributes inherited from Obi.ObiActor
int m_ActiveParticleCount = 0
 
ObiSolver m_Solver
 
bool m_Loaded = false
 
ObiCollisionMaterial m_CollisionMaterial
 
bool m_SurfaceCollisions = false
 
float m_MassScale = 1
 

Properties

bool selfCollisions [get, set]
 Whether particles in this actor colide with particles using the same phase value. More...
 
bool stretchShearConstraintsEnabled [get, set]
 Whether this actor's stretch/shear constraints are enabled. More...
 
float stretchCompliance [get, set]
 Compliance of this actor's stretch/shear constraints, along their length. More...
 
float shear1Compliance [get, set]
 Shearing compliance of this actor's stretch/shear constraints, along the first axis orthogonal to their length. More...
 
float shear2Compliance [get, set]
 Shearing compliance of this actor's stretch/shear constraints, along the second axis orthogonal to their length. More...
 
bool bendTwistConstraintsEnabled [get, set]
 Whether this actor's bend/twist constraints are enabled. More...
 
float torsionCompliance [get, set]
 Torsional compliance of this actor's bend/twist constraints along their length. More...
 
float bend1Compliance [get, set]
 Bending compliance of this actor's bend/twist constraints along the first axis orthogonal to their length. More...
 
float bend2Compliance [get, set]
 Bending compliance of this actor's bend/twist constraints along the second axis orthogonal to their length. More...
 
float plasticYield [get, set]
 Threshold for plastic behavior. More...
 
float plasticCreep [get, set]
 Percentage of deformation that gets absorbed into the rest shape per second, once deformation goes above the plasticYield threshold. More...
 
bool chainConstraintsEnabled [get, set]
 Whether this actor's chain constraints are enabled. More...
 
float tightness [get, set]
 Tightness of this actor's chain constraints. More...
 
float interParticleDistance [get]
 Average distance between consecutive particle centers in this rod. More...
 
override ObiActorBlueprint sourceBlueprint [get]
 
ObiRodBlueprint rodBlueprint [get, set]
 
- Properties inherited from Obi.ObiRopeBase
bool aerodynamicsEnabled [get, set]
 Whether this actor's aerodynamic constraints are enabled. More...
 
float drag [get, set]
 Aerodynamic drag value. More...
 
float lift [get, set]
 Aerodynamic lift value. More...
 
float restLength [get]
 
ObiPath path [get]
 
- Properties inherited from Obi.ObiActor
int deformableEdgesOffset [get, set]
 
ObiSolver solver [get]
 The solver in charge of simulating this actor. More...
 
bool isLoaded [get]
 True if the actor blueprint has been loaded into a solver. If true, it guarantees actor.solver, actor.solverIndices and actor.solverBatchOffsets won't be null. More...
 
ObiCollisionMaterial collisionMaterial [get, set]
 The collision material being used by this actor. More...
 
virtual bool surfaceCollisions [get, set]
 Whether to use simplices (triangles, edges) for contact generation. More...
 
float massScale [get, set]
 Scale applied to this actor's particle masses. More...
 
int particleCount [get]
 Amount of particles allocated by this actor. More...
 
int activeParticleCount [get]
 Amount of particles in use by this actor. More...
 
bool usesOrientedParticles [get]
 Whether this actors makes use of particle orientations or not. More...
 
virtual bool usesAnisotropicParticles [get]
 If true, it means particles may not be completely spherical, but ellipsoidal. More...
 
Oni.SimplexType simplexTypes [get]
 
Matrix4x4 actorLocalToSolverMatrix [get]
 Matrix that transforms from the actor's local space to the solver's local space. More...
 
Matrix4x4 actorSolverToLocalMatrix [get]
 Matrix that transforms from the solver's local space to the actor's local space. More...
 
abstract ObiActorBlueprint sourceBlueprint [get]
 Reference to the blueprint asset used by this actor. More...
 
ObiActorBlueprint sharedBlueprint [get]
 Reference to the blueprint in use by this actor. More...
 
ObiActorBlueprint blueprint [get]
 Returns a unique instance of this actor's sourceBlueprint. More...
 
- Properties inherited from Obi.IObiParticleCollection
int particleCount [get]
 
int activeParticleCount [get]
 
bool usesOrientedParticles [get]
 
- Properties inherited from Obi.IAerodynamicConstraintsUser
bool aerodynamicsEnabled [get, set]
 
- Properties inherited from Obi.IStretchShearConstraintsUser
bool stretchShearConstraintsEnabled [get, set]
 
- Properties inherited from Obi.IBendTwistConstraintsUser
bool bendTwistConstraintsEnabled [get, set]
 
- Properties inherited from Obi.IChainConstraintsUser
bool chainConstraintsEnabled [get, set]
 
float tightness [get, set]
 

Additional Inherited Members

- Public Attributes inherited from Obi.ObiRopeBase
List< ObiStructuralElementelements = new List<ObiStructuralElement>()
 
- Public Attributes inherited from Obi.ObiActor
ObiNativeIntList solverIndices
 Index of each one of the actor's particles in the solver. More...
 
List< int >[] solverBatchOffsets
 For each of the actor's constraint types, offset of every batch in the solver. More...
 
int groupID = 0
 
- Events inherited from Obi.ObiRopeBase
ActorCallback OnElementsGenerated
 
- Events inherited from Obi.ObiActor
ActorBlueprintCallback OnBlueprintLoaded
 Called when the actor blueprint has been loaded into the solver. More...
 
ActorBlueprintCallback OnBlueprintUnloaded
 Called when the actor blueprint has been unloaded from the solver. More...
 
ActorBlueprintCallback OnBlueprintRegenerated
 Called when the blueprint currently in use has been re-generated. This will always be preceded by a call to OnBlueprintUnloaded and OnBlueprintLoaded. More...
 
ActorStepCallback OnSimulationStart
 Called before simulation starts. More...
 
ActorStepCallback OnSimulationEnd
 Called after simulation ends. More...
 
ActorCallback OnRequestReadback
 You can use this callback to issue GPU->CPU readbacks. More...
 
ActorStepCallback OnInterpolate
 Called at the end of each frame, after interpolation but before rendering. More...
 

Property Documentation

float Obi.ObiRod.bend1Compliance
getset

Bending compliance of this actor's bend/twist constraints along the first axis orthogonal to their length.

float Obi.ObiRod.bend2Compliance
getset

Bending compliance of this actor's bend/twist constraints along the second axis orthogonal to their length.

bool Obi.ObiRod.bendTwistConstraintsEnabled
getset

Whether this actor's bend/twist constraints are enabled.

bool Obi.ObiRod.chainConstraintsEnabled
getset

Whether this actor's chain constraints are enabled.

float Obi.ObiRod.interParticleDistance
get

Average distance between consecutive particle centers in this rod.

float Obi.ObiRod.plasticCreep
getset

Percentage of deformation that gets absorbed into the rest shape per second, once deformation goes above the plasticYield threshold.

float Obi.ObiRod.plasticYield
getset

Threshold for plastic behavior.

Once bending goes above this value, a percentage of the deformation (determined by plasticCreep) will be permanently absorbed into the rod's rest shape.

bool Obi.ObiRod.selfCollisions
getset

Whether particles in this actor colide with particles using the same phase value.

float Obi.ObiRod.shear1Compliance
getset

Shearing compliance of this actor's stretch/shear constraints, along the first axis orthogonal to their length.

float Obi.ObiRod.shear2Compliance
getset

Shearing compliance of this actor's stretch/shear constraints, along the second axis orthogonal to their length.

float Obi.ObiRod.stretchCompliance
getset

Compliance of this actor's stretch/shear constraints, along their length.

bool Obi.ObiRod.stretchShearConstraintsEnabled
getset

Whether this actor's stretch/shear constraints are enabled.

float Obi.ObiRod.tightness
getset

Tightness of this actor's chain constraints.

Controls how much chain constraints are allowed to compress.

float Obi.ObiRod.torsionCompliance
getset

Torsional compliance of this actor's bend/twist constraints along their length.


The documentation for this class was generated from the following file: