Class: RubySketch::LinkConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- RubySketch::LinkConstraint
- Defined in:
- lib/rubysketch/constraint.rb
Overview
Keeps two points apart at a distance, or slides them along an axis like a rail.
Instance Method Summary collapse
-
#axis ⇒ Vector?
Returns the axis to slide along.
-
#axis=(axis) ⇒ Vector, ...
Sets the axis to slide along.
-
#currentDistance ⇒ Numeric
Returns the current distance between the two points.
-
#distance ⇒ Numeric
(also: #dist)
Returns the distance to keep.
-
#distance=(distance) ⇒ Numeric
(also: #dist=)
Sets the distance to keep.
-
#motor ⇒ Numeric?
Returns the motor speed.
-
#motor=(speed) ⇒ Numeric?
Sets the motor speed that drives the separation.
-
#range ⇒ Range?
Returns the range of the separation.
-
#range=(range) ⇒ Range, ...
Sets the range of the separation.
Methods inherited from Constraint
#active?, #collide=, #collide?, #damping, #damping=, #force, #force=, #remove, #removed?, #spring, #spring=, #sprites
Instance Method Details
#axis ⇒ Vector?
Returns the axis to slide along.
251 252 253 |
# File 'lib/rubysketch/constraint.rb', line 251 def axis() @constraint__.axis&.toVector end |
#axis=(axis) ⇒ Vector, ...
Sets the axis to slide along. With an axis, the separation is measured along it instead of radially, and the relative rotation is locked like a rail.
243 244 245 |
# File 'lib/rubysketch/constraint.rb', line 243 def axis=(axis) @constraint__.axis = RubySketch.unwrap__ axis end |
#currentDistance ⇒ Numeric
Returns the current distance between the two points.
277 278 279 |
# File 'lib/rubysketch/constraint.rb', line 277 def currentDistance() @constraint__.current_distance end |
#distance ⇒ Numeric Also known as: dist
Returns the distance to keep.
269 270 271 |
# File 'lib/rubysketch/constraint.rb', line 269 def distance() @constraint__.distance end |
#distance=(distance) ⇒ Numeric Also known as: dist=
Sets the distance to keep.
261 262 263 |
# File 'lib/rubysketch/constraint.rb', line 261 def distance=(distance) @constraint__.distance = distance end |
#motor ⇒ Numeric?
Returns the motor speed.
314 315 316 |
# File 'lib/rubysketch/constraint.rb', line 314 def motor() @constraint__.motor end |
#motor=(speed) ⇒ Numeric?
Sets the motor speed that drives the separation.
306 307 308 |
# File 'lib/rubysketch/constraint.rb', line 306 def motor=(speed) @constraint__.motor = speed end |
#range ⇒ Range?
Returns the range of the separation.
296 297 298 |
# File 'lib/rubysketch/constraint.rb', line 296 def range() @constraint__.range end |
#range=(range) ⇒ Range, ...
Sets the range of the separation.
288 289 290 |
# File 'lib/rubysketch/constraint.rb', line 288 def range=(range) @constraint__.range = range end |