//---------------------------------------------------------------------------------- public SimVertex(float mass, SimObjectType simObjectType, int vertexId, TexturedPrimitive primitive) : base(mass, simObjectType) { this.vertexId = vertexId; this.primitive = primitive; this.currPosition = primitive.GetVertexPosition(vertexId); this.prevPosition = currPosition; }
private void CreateSimVerticesForGoal(TexturedPrimitive softBodyObject, float mass) { int numVertices = softBodyObject.NumVertices; float vertexMass = mass / numVertices; simVerticesForGoal = new SimVertex[numVertices]; for (int i = 0; i < numVertices; i++) { simVerticesForGoal[i] = new SimVertex(vertexMass, SimObjectType.PASSIVE, i, softBodyObject); this.AddSimObject(simVerticesForGoal[i]); } }
public GoalSoftBodySim(Game game, TexturedPrimitive softBodyObject, TexturedPrimitive softBodyGoalObject, float mass, float stiffness, float damping) : base(game) { this.softBodyObject = softBodyObject; this.softBodyGoalObject = softBodyGoalObject; //create sim vertices on both the goal and non-goal object CreateSimVertices(softBodyObject, mass); CreateSimVerticesForGoal(softBodyGoalObject, mass); //connect springs between the vertices of the goal and non-goal object ConnectSprings(stiffness, damping); }