CNA Samples

Transformed Collision Test

Ported from the second runnable game in Microsoft's XNA 4.0 Transformed Collision sample.

Source for this sample on GitHub ↗

Two movable letter sprites, F and R, above a grey view of their collision space. Play ▸

Opens in a new tab. Click the canvas so it receives mouse and keyboard input.

About this sample

Transform the F and R sprites and watch the background turn red when their visible pixels intersect. The grey drawing shows one sprite in the other's local coordinate space, making rotation, scale and origin changes visible.

Controls

ActionMouse / keyboardGamepad
Move spriteDrag F with left button; R with right buttonHold its trigger and move left stick
Move originHold Left Ctrl while draggingHold its shoulder and move left stick
RotateMouse wheel or Left / Right arrow while draggingHold its trigger and move right stick horizontally
ScaleAlt + mouse wheel or Up / Down arrow while draggingHold its trigger and move right stick vertically
ExitEsc or close the tabBack