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:
- steer - along the Y axis / new Vector3(0, 1, 0)
- roll - along the Z axis / new Vector3(0, 0, 1)
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).
perimeter:Number
[read-only]Implementation
public function get perimeter():Number
radius:Number
[read-only]Implementation
public function get radius():Number
public var rollVector:Vector3
public var speed:Number
public var steerVector:Vector3
step:Number
[read-only]Implementation
public function get step():Number
public var turn:Number
public function Wheel()
public function apply():void
public override function setModifiable(mod:MeshProxy):void
Parameters