Class: RubySketch::WheelConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- RubySketch::WheelConstraint
- Defined in:
- lib/rubysketch/constraint.rb
Overview
Rides on the target like a wheel: slides along an axis for the suspension while spinning freely.
Instance Method Summary collapse
-
#axis ⇒ Vector
Returns the axis to slide along.
-
#axis=(axis) ⇒ Vector, Array<Numeric>
Sets the axis to slide along for the suspension.
-
#motor ⇒ Numeric?
Returns the motor speed.
-
#motor=(speed) ⇒ Numeric?
Sets the motor speed that spins the wheel.
-
#range ⇒ Range?
Returns the range of the translation along the axis.
-
#range=(range) ⇒ Range, ...
Sets the range of the translation along the axis.
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.
345 346 347 |
# File 'lib/rubysketch/constraint.rb', line 345 def axis() @constraint__.axis&.toVector end |
#axis=(axis) ⇒ Vector, Array<Numeric>
Sets the axis to slide along for the suspension.
337 338 339 |
# File 'lib/rubysketch/constraint.rb', line 337 def axis=(axis) @constraint__.axis = RubySketch.unwrap__ axis end |
#motor ⇒ Numeric?
Returns the motor speed.
383 384 385 386 |
# File 'lib/rubysketch/constraint.rb', line 383 def motor() speed = @constraint__.motor speed && fromDegrees__(speed) end |
#motor=(speed) ⇒ Numeric?
Sets the motor speed that spins the wheel.
375 376 377 |
# File 'lib/rubysketch/constraint.rb', line 375 def motor=(speed) @constraint__.motor = speed && toDegrees__(speed) end |
#range ⇒ Range?
Returns the range of the translation along the axis.
363 364 365 |
# File 'lib/rubysketch/constraint.rb', line 363 def range() @constraint__.range end |
#range=(range) ⇒ Range, ...
Sets the range of the translation along the axis.
355 356 357 |
# File 'lib/rubysketch/constraint.rb', line 355 def range=(range) @constraint__.range = range end |