Extras

There are two bonus extras included and can be found in the Scripts Folder.

  1. GyroRotate

  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.

		powerInput = PivecLabs.Mobile.TouchStickPedals.yaxis;
		turnInput = PivecLabs.Mobile.TouchStickSteeringWheel.xaxis;

and the are applied to a Rigid Body as force and torque as shown.

	carRigidbody.AddRelativeForce(0f, 0f, powerInput;
	carRigidbody.AddRelativeTorque(0f, turnInput, 0f);

The bonus script also adds a multiplier of speed to the Force and turnSpeed to the Torque.

carRigidbody.AddRelativeForce(0f, 0f, powerInput * speed);
carRigidbody.AddRelativeTorque(0f, turnInput * turnSpeed, 0f);

Last updated