public void Evaluate(int SpreadMax) { if (FBodies.PluginIO.IsConnected && this.FWorld.PluginIO.IsConnected) { for (int i = 0; i < SpreadMax; i++) { if (FDoCreate[i]) { T cst = this.CreateConstraint(this.FBodies[i], i); ConstraintCustomData cust = new ConstraintCustomData(); cust.Id = this.FWorld[0].GetNewConstraintId(); cust.Custom = this.FCustom[i]; cust.IsSingle = true; if (FCustomObject.PluginIO.IsConnected) { cust.CustomObject = FCustomObject[i]; } cst.UserObject = cust; this.FWorld[0].Register(cst); } } } }
public void Evaluate(int SpreadMax) { if (this.FInput.IsConnected) { this.FType.SliceCount = SpreadMax; this.FLifeTime.SliceCount = SpreadMax; this.FId.SliceCount = SpreadMax; this.FCustom.SliceCount = SpreadMax; for (int i = 0; i < SpreadMax; i++) { TypedConstraint cst = FInput[i]; ConstraintCustomData sc = (ConstraintCustomData)cst.UserObject; FType[i] = cst.ConstraintType; FId[i] = sc.Id; FLifeTime[i] = sc.LifeTime; FCustom[i] = sc.Custom; } } else { this.FType.SliceCount = 0; this.FLifeTime.SliceCount = 0; this.FId.SliceCount = 0; this.FCustom.SliceCount = 0; } }
internal void ProcessDelete() { int cnt = this.RigidBodies.Count; for (int i = 0; i < cnt; i++) { RigidBody body = this.RigidBodies[i]; BodyCustomData bd = (BodyCustomData)body.UserObject; bd.Created = false; if (bd.MarkedForDeletion) { if (this.RigidBodyDeleted != null) { this.RigidBodyDeleted(body, bd.Id); } this.Unregister(body); } } cnt = this.SoftBodies.Count; for (int i = 0; i < cnt; i++) { SoftBody body = this.SoftBodies[i]; BodyCustomData bd = (BodyCustomData)body.UserObject; bd.Created = false; if (bd.MarkedForDeletion) { if (this.SoftBodyDeleted != null) { this.SoftBodyDeleted(body, bd.Id); } this.Unregister(body); } } cnt = this.Constraints.Count; for (int i = 0; i < cnt; i++) { TypedConstraint cst = this.constraints[i]; ConstraintCustomData cd = (ConstraintCustomData)cst.UserObject; cd.Created = false; if (cd.MarkedForDeletion) { if (this.ConstraintDeleted != null) { this.ConstraintDeleted(cst, cd.Id); } this.Unregister(cst); } } }
public void Evaluate(int SpreadMax) { if (FInput.PluginIO.IsConnected) { for (int i = 0; i < SpreadMax; i++) { if (FApply[i]) { TypedConstraint cst = this.FInput[i]; ConstraintCustomData cust = (ConstraintCustomData)cst.UserObject; cust.MarkedForDeletion = true; } } } }
internal void ProcessDelete(double dt) { List <RigidBody> todelete = new List <RigidBody>(); List <int> deleteid = new List <int>(); int cnt = this.RigidBodies.Count; for (int i = 0; i < cnt; i++) { RigidBody body = this.RigidBodies[i]; BodyCustomData bd = (BodyCustomData)body.UserObject; if (!bd.Created) { bd.LifeTime += dt; } bd.Created = false; if (bd.MarkedForDeletion) { todelete.Add(body); deleteid.Add(bd.Id); } } for (int i = 0; i < todelete.Count; i++) { RigidBody body = todelete[i]; if (this.RigidBodyDeleted != null) { this.RigidBodyDeleted(body, deleteid[i]); } this.Unregister(body); } cnt = this.SoftBodies.Count; for (int i = 0; i < cnt; i++) { SoftBody body = this.SoftBodies[i]; BodyCustomData bd = (BodyCustomData)body.UserObject; if (!bd.Created) { bd.LifeTime += dt; } bd.Created = false; if (bd.MarkedForDeletion) { if (this.SoftBodyDeleted != null) { this.SoftBodyDeleted(body, bd.Id); } this.Unregister(body); } } cnt = this.Constraints.Count; for (int i = 0; i < cnt; i++) { TypedConstraint cst = this.constraints[i]; ConstraintCustomData cd = (ConstraintCustomData)cst.UserObject; if (!cd.Created) { cd.LifeTime += dt; } cd.Created = false; if (cd.MarkedForDeletion) { if (this.ConstraintDeleted != null) { this.ConstraintDeleted(cst, cd.Id); } this.Unregister(cst); } else { cd.LifeTime += dt; } } }