Search in sources :

Example 1 with CollisionBehavior

use of artisynth.core.mechmodels.CollisionBehavior in project artisynth_core by artisynth.

the class SetDefaultCollisionsCommand method execute.

public void execute() {
    for (CollidablePair pair : myNewBehaviors.keySet()) {
        Group g0 = (Group) pair.get(0);
        Group g1 = (Group) pair.get(1);
        CollisionBehavior oldBehav = myMechMod.getDefaultCollisionBehavior(g0, g1);
        myOldBehaviors.put(new CollidablePair(pair), new CollisionBehavior(oldBehav));
        CollisionBehavior newBehav = myNewBehaviors.get(pair);
        myMechMod.setDefaultCollisionBehavior(g0, g1, newBehav);
    }
}
Also used : Group(artisynth.core.mechmodels.Collidable.Group) CollidablePair(artisynth.core.mechmodels.CollidablePair) CollisionBehavior(artisynth.core.mechmodels.CollisionBehavior)

Example 2 with CollisionBehavior

use of artisynth.core.mechmodels.CollisionBehavior in project artisynth_core by artisynth.

the class SetDefaultCollisionsCommand method undo.

public void undo() {
    for (CollidablePair pair : myOldBehaviors.keySet()) {
        CollisionBehavior oldBehav = myOldBehaviors.get(pair);
        myMechMod.setDefaultCollisionBehavior((Group) pair.get(0), (Group) pair.get(1), oldBehav);
    }
}
Also used : CollidablePair(artisynth.core.mechmodels.CollidablePair) CollisionBehavior(artisynth.core.mechmodels.CollisionBehavior)

Example 3 with CollisionBehavior

use of artisynth.core.mechmodels.CollisionBehavior in project artisynth_core by artisynth.

the class FemMuscleArm method getCollisions.

public boolean getCollisions() {
    MechModel mech = (MechModel) models().get(0);
    PointToPointMuscle muscle = (PointToPointMuscle) mech.findComponent("models/0");
    RigidBody upperArm = (RigidBody) mech.findComponent("rigidBodies/upper");
    if (muscle == null || upperArm == null) {
        return false;
    }
    CollisionBehavior cb = mech.getCollisionBehavior(muscle, upperArm);
    return cb != null && cb.isEnabled();
}
Also used : MechModel(artisynth.core.mechmodels.MechModel) CollisionBehavior(artisynth.core.mechmodels.CollisionBehavior) PointToPointMuscle(artisynth.core.femmodels.PointToPointMuscle) RigidBody(artisynth.core.mechmodels.RigidBody)

Aggregations

CollisionBehavior (artisynth.core.mechmodels.CollisionBehavior)3 CollidablePair (artisynth.core.mechmodels.CollidablePair)2 PointToPointMuscle (artisynth.core.femmodels.PointToPointMuscle)1 Group (artisynth.core.mechmodels.Collidable.Group)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidBody (artisynth.core.mechmodels.RigidBody)1