Packagecom.as3dmod.modifiers
Classpublic class Wheel
InheritanceWheel Inheritance Modifier
ImplementsIModifier

Wheel modifier. Use it with vehicle models for wheels.

The usual problem with a 3d wheel in a vahicle is that if it is supposed to turn (steer) and roll in the same time. So, this code:

   wheel.rotationY = 10; // Steer 10deg to the left
   wheel.rotationZ +- 5; // Roll with a speed of 5
   

This will make the wheel roll incorectly.

A usual way to solve this problem is to put the wheel in another DisplayObject3D/Mesh, turn the parent and roll the child, like that:

   steer.rotationY = 10; // Steer 10deg to the left
   steer.wheel.rotationZ +- 5; // Roll with a speed of 5
   

That will make the wheel behave correctly. But it can be uncomfortanble to apply, especially to imported complex Collada models.

The Wheel modifier elegantly solves this problem by doind the proper math in order to steer and roll a single mesh at the same time. The only thing you need to do is to specify a steer vector and roll vector - usually it will be 2 of the cardinal axes. The default value is:

It should work with most car models imported from 3D editors as this is the natural position of a wheel.
Please note, that Papervision primitive cylinder, which may also be used as wheel, will require different axes (Y for roll and Z or X for steer).



Public Properties
 PropertyDefined by
  perimeter : Number
[read-only]
Wheel
  radius : Number
[read-only]
Wheel
  rollVector : Vector3
Wheel
  speed : Number
Wheel
  steerVector : Vector3
Wheel
  step : Number
[read-only]
Wheel
  turn : Number
Wheel
Protected Properties
 PropertyDefined by
 Inheritedmod : MeshProxy
Modifier
Public Methods
 MethodDefined by
  
Wheel
  
apply():void
Wheel
 Inherited
getVertices():Array
Modifier
  
Wheel
Property detail
perimeterproperty
perimeter:Number  [read-only]Implementation
    public function get perimeter():Number
radiusproperty 
radius:Number  [read-only]Implementation
    public function get radius():Number
rollVectorproperty 
public var rollVector:Vector3
speedproperty 
public var speed:Number
steerVectorproperty 
public var steerVector:Vector3
stepproperty 
step:Number  [read-only]Implementation
    public function get step():Number
turnproperty 
public var turn:Number
Constructor detail
Wheel()constructor
public function Wheel()
Method detail
apply()method
public function apply():void
setModifiable()method 
public override function setModifiable(mod:MeshProxy):voidParameters
mod:MeshProxy