Motion

From Castle Wiki
Revision as of 09:14, 7 July 2022 by Lukalot (talk | contribs) (Minor punctuation changes, density vs mass correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Motion is a Behavior that allows Actors to move through Card space.

Using Motion

To add motion to a Blueprint, open the Inspector for that blueprint, navigate to the Movement tab, and change the Motion control to either Fixed or Dynamic. If you aren't sure which one you need, it's usually better to pick Dynamic. See below for more details on the differences between fixed and dynamic motion.

Fixed vs. Dynamic motion

Actors with Fixed Motion move at a constant rate; their velocity can never be changed by outside forces like Collisions. This can be useful if, for example, you want a windmill which always rotates the same way, or a cloud which drifts across the screen.

Actors with Dynamic Motion can change their velocity when they are acted on by external forces. This is usually what you want for any object where you expect it to have physics. In fact, dynamic motion is required to add interactive controls, such as Drag, and to change the way actors move through space, such as making them Slow Down.

Internally, Castle uses Box2D, where fixed motion corresponds to a kinematic body and dynamic motion corresponds to a dynamic body.

Initial Dynamic Motion Parameters

X Velocity

The initial velocity of the object in its X axis when it's created.

Y Velocity

The initial velocity of the object in its Y axis when it's created.

Rotational Velocity

The initial rotational velocity of the object when it's created.

Density

The density of the object, which is factored into its mass.