Recherche Google
ModalysConnections > Destroy Connection
page précédentepage suivante

Destroy Connection


Destroys a connection.

(destroy-connection ... )

Lisp Syntax and Default Values

The (destroy-connection ... ) function can be used via the following Lisp syntax:

(destroy-connection connection_reference )


The (destroy-connection ...) function takes one argument:

  • connection_reference: any connection.

This function should be used with care, as it is tricky to use. It is useful if you are writing a Modalys component and you want it to be very efficient, or if you are trying to make an overly slow synthesis run a bit faster. The idea is if you make a “pluck” connection between two objects, they are always “watching” each other. The “watching” takes a certain amount of computation time, and continues even when you know the objects cannot possibly touch because the pluck is finished. (Modalys can never know for sure whether the objects will touch again, since the plucker could always return for another pluck...) So you can write:

(define my-connection (make-connection 'pluck ... ))


(run 3) ; we know the pluck happens during these 3 seconds of synthesis

(destroy-connection my-connection)

(run 1)

This will create 4 seconds of synthesis, and there will be some speedup after the third second. Note that this speedup is not enormous, and is often not worth the trouble. You see, if the pluck has not quite finished by the third second, you may get a click or something as the objects are forcibly separated! Any type of connection can be destroyed this way, except force connections. There is usually no point to destroying force connections anyway as they are very inexpensive computationally. Note that a 'force connection with a controller value of zero newtons has no influence whatsoever on an object.

In some cases, you might want to first test to see if a connection is currently active or inactive before you destroy it. To do this you could use:

(get-info 'connection my-connection 'state)


There are no special options for this function.

page précédentepage suivante
A propos...©IRCAM 2014Réalisé avec Scenari