AERO

From Creatures Wikia

Jump to: navigation, search

AERO is a CAOS command and function used to edit or output the amount of air resistance an agent has. It only applies if the 'suffer physics' attribute flag is set.

Usage

Command

Syntax: AERO air_resistance(int)

Sets the air resistance property of the current TARG in percent. The agent will lose air_resistance% velocity per tick in both directions.

Function

Syntax: AERO

Returns the value stored in TARG's AERO property, as above.

Examples

You might want to change the value of an object's air resistance if it changes its size. Let's say we're making an object using the hoverdoc sprites. We'll have it start out curled up, then unfold on click. Air resistance is proportional to surface area - in the hoverdoc's case this will be different depending on which way it's moving, but let's just average the height and width and call that the surface. What follows is a complete working example agent.

INST
NEW: SIMP 1 1 10642 "hoverdoc" 13 0 2000

* 2 mouse-carryable + 4 activateable + 64 collisions + 128 physics:
ATTR 198

ACCG 10 FRIC 60 ELAS 10
CLIK 0 1 -1

* folded hoverdoc. size 54x35; avg. 44.5; scale factor 1/3
POSE 0
AERO 15

MVSF MOPX MOPY

* activate 1: unfold
scrp 1 1 10642 1
  * move the agent up so it doesn't get caught between rooms
  SETV va00 POST
  SUBV va00 83
  MVSF POSL va00

  * unfolded hoverdoc. size 76x118; avg 97; scale factor 1/3
  POSE 12
  AERO 32
endm

* activate 2: fold
scrp 1 1 10642 2
  * folded hoverdoc.
  POSE 0
  AERO 15
endm

rscr
ENUM 1 1 10642 KILL TARG NEXT
SCRX 1 1 10642 1
SCRX 1 1 10642 2

Equivalent in the real world

CEE's use of AERO is close to real-world air resistance. In rough models, deceleration due to air resistance is usually taken to be proportional either to speed, for low speeds, or to the square of speed, for higher ones.

Personal tools