Building your first 3D game with the Q3D plugin

  • 9 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.capx

q3dsamplegame.capx

Download now 227.95 KB

Stats

7,623 visits, 15,767 views

Translations

This tutorial hasn't been translated.

Tools

Part III – The Event Sheet - The "ARROW KEY CONTROLS" Group

The initial setup is complete, but right now you have a car that you can't control. For this tutorial, we will use the arrows keys to control the car.

Because this is a physics simulation, the arrow keys don't actually control the car at all -- they apply torque to the wheels, causing the wheels to spin. This torque is applied to an axis that is normal to the plane of rotation of the wheels. I strongly recommend reading the Q3D manual entry on the difference between the nNx, nTx, and nBx vectors for a better understanding of these axes.

Instead of brakes, we have given a significant amount of "Angular Damping" to the wheels to slow down their rotation when we aren't applying torque. You can adjust both the wheel torque and the angular damping to achieve a satisfying level of responsiveness and control.

Driving Forward

Apply a forward torque to all 4 wheels.

Driving Backward

Apply a reverse torque to all 4 wheels.

Turning Left

Apply a forward torque to each of the right 2 wheels, and apply a reverse torque to each of the left 2 wheels.

Turning Right

Apply a forward torque to each of the left 2 wheels, and apply a reverse torque to each of the right 2 wheels.

The screenshot below shows the necessary events to get the wheels working.

The screenshot below shows how to apply a torque to each wheel to turn the car to the left.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!