Table of Contents

Turning or Steering

Good for vehicle steering or turning ships and planes.

Code

car = orxObject_CreateFromConfig("CarObject");
 
...
 
if(orxInput_IsActive("Right")){
  orxFLOAT rotation = orxObject_GetRotation(car);
 
  orxVECTOR relativeSpeed = orxVECTOR_0;
  orxObject_GetRelativeSpeed(car, &relativeSpeed);
 
  rotation += 0.01;
  orxObject_SetRotation(car, rotation);
  orxObject_SetRelativeSpeed(car, &relativeSpeed); //reapply the relative speed.
}

Config

[CarObject]
Graphic = CarGraphic
Position = (300, 200, 0)
Speed = (0, 30, 0)
UseRelativeSpeed = true
 
[CarGraphic]
Texture = car.png
Pivot = (38, 30, 0)