Extras
There are two bonus extras included and can be found in the Scripts Folder.
  1. 1.
    GyroRotate
  2. 2.
    HoverMotor

GyroRotate

Attach this script to any Game Object and add the Object to rotate to the appropriate slot in the script. The Object will rotate with the movement of the mobile device.

HoverMotor

This script is used in Example 5 to control the Vehicle using the Steering Wheel and Pedal Touchsticks. You can attach it to any vehicle that you want to move like a Hover Bike. You can adjust the speed, turns, force and height to suit you needs.
The main purpose of this script is to show how you can use the Steering wheel and Pedal Touchsticks with any vehicle. The Steering Wheel provides the x Axis, and the Pedals provide the y Axis. Hence the Axis are applied to the script for powerInput and turnInput float feilds.
1
powerInput = PivecLabs.Mobile.TouchStickPedals.yaxis;
2
turnInput = PivecLabs.Mobile.TouchStickSteeringWheel.xaxis;
3
Copied!
and the are applied to a Rigid Body as force and torque as shown.
1
carRigidbody.AddRelativeForce(0f, 0f, powerInput;
2
carRigidbody.AddRelativeTorque(0f, turnInput, 0f);
Copied!
The bonus script also adds a multiplier of speed to the Force and turnSpeed to the Torque.
1
carRigidbody.AddRelativeForce(0f, 0f, powerInput * speed);
2
carRigidbody.AddRelativeTorque(0f, turnInput * turnSpeed, 0f);
Copied!
Last modified 10mo ago
Copy link