# Palomino - Physics Module

©2004,2009 Jim E. Brooks http://www.palomino3d.org

- Index
- Overview
- Forces

- Contact Force
- Safe Contact

- CraftPhysics

- Control of Craft
- Coordinated Turn
- Landing

## Overview

[2008/01]

Physics computations are done in terms of SI units (metric). The physics module consults Geo to convert between physical metrics and graphical coordinates.

## Forces

[2008/02]

### Overview

Net force is the sum of vector addition. However, not all physical forces are simulated, and physical forces are computed in a particular order.

### Contact Force

Contact force is not simply negative weight. Rather, it's the negative of net weight.

Imagine a propeller aircraft on a runway rotated upward slightly. The vertical coordinate of engine thrust counteracts its weight. Contact force is the sum of absolute weight minus the engine's vertical force.

Geo has a registered list of RigidBody objects.

## CraftPhysics

[2008/02]

CraftPhysics is specialized for aircraft.

- Simulates the 4 fundamental forces: thrust/drag/weight/lift.
- Physics computations are done in terms of physical metrics (SI units) and converted to graphical coordinates.
- Speed gradually increases from thrust.
- Drag increases as speed increases, opposite to direction of velocity, and will balance thrust, thereby limiting speed.

A Craft (or derivative), a CraftPhysics, and CraftSpecs will be bound together at run-time. For example, P51Aircraft has a CraftPhysics object that stores and computes physical state as determined by data in a CraftSpecs which defines the characteristics of a P-51D Mustang.

The CraftPhysics class is written in terms of the Craft interface and can manipulate (move) a Craft object. Craft is a derivative of Dyna and Dyna in turn is derived from Object. A reason is that Craft defines the axises of the local coordinate space which CraftPhysics needs access to. For example, the thrust vector correlates to a Craft's Z axis. CraftPhysics will call Craft::Translate(axis,step) to move along an axis.

The animation convention is for a 3D Object to register a timer-tick handler. When a tick arrives, a Craft will defer its animation to its CraftPhysics member. CraftPhysics computes a net vector offset in World Space then CraftPhysics changes the position of a Craft (moves it) in terms of the Craft interface.

    tick event  Dyna::Tick()  CraftPhysics::MoveObject()

## Coordinated Turn

[2008/01]

Coordinated turn means coordinated control of pitch/roll/yaw during a normal banked turn. Controlling only pitch and roll isn't sufficient. What would happen (in the sim) without yaw is that the craft would pitch up too much. Yawing in the direction of the turn is necessary to keep the nose level during the turn.

The program can help the player do a coordinated turn by automatically controlling yaw. The reasons are that most joysticks lack a third axis to control yaw, and some users may have difficulty controlling 3 axises at a time.

For an automatic coordinated turn, the degree of yaw is approximately the same as the degree of pitch but in the direction of the turn. The difficulty in implementing this is detecting when the player wants to do a normal banked turn. For example, the player would be diving, then does a roll followed by a pitch. The roll/pitch sequence would be a false indicator since the player is really changing the direction of the dive, not doing a banked turn.

## Landing

[2008/03]

Behavior of landing is more user-friendly than realistic. When the player touches the runway, the program grabs control of the player's Aircraft. It will automatically stop downward velocity and pitch up/down in to level the Aircraft. The player will still need to apply brakes.

Last modified: Sun Nov 22 21:23:00 CST 2009