# Collision Normal Bounce Math

Use vectors, surface normals, and restitution to make one 2D bounce predictable before building a whole physics-heavy game.

## Outcome
Build a one-wall Godot bounce proof where incoming velocity, collision normal, outgoing velocity, and energy loss are visible.

## Safe first step
Sketch one contact: incoming arrow, surface normal, reflected arrow, and the value that proves the bounce is repeatable.

## Ladder steps
### 1. Name the contact
Use one moving object and one surface before adding a full room.

Check: The collision has one object, one wall, and one expected normal.

### 2. Draw incoming velocity
Velocity is both direction and speed, so write the vector before changing code.

Check: The incoming arrow can be described before it touches the surface.

### 3. Read the surface normal
The normal points out from the surface and decides which velocity component flips.

Check: The normal is logged or sketched for the contact point.

### 4. Scale the reflected vector
Restitution controls how much speed remains after the bounce.

Check: The outgoing arrow is shorter, equal, or longer for an explicit reason.

## Examples
### Reflect a velocity
```sh
velocity = velocity.bounce(normal)
```
Expected signal: The outgoing direction changes across the surface normal

### Scale the bounce
```sh
speed_after = speed_before * restitution
```
Expected signal: Lower restitution makes a duller bounce

### Log one collision
```sh
print(velocity, normal)
```
Expected signal: Debug the vector before tuning game feel

## Common traps
- Changing shape, speed, friction, and restitution at the same time.
- Assuming a wall normal without checking what the engine reports.
- Using a full level before one repeatable bounce works.
- Treating a bad bounce as a visual polish problem before logging vectors.

## Practice task
Use the widget to choose incoming velocity, normal angle, and restitution. Copy the note, then reproduce one wall bounce in a tiny Godot scene.

## Next steps
- Save the Obsidian note with [[Godot]], [[Collision Normal]], [[Vector Reflection]], [[Velocity]], [[Restitution]], [[Surface Normal]], [[move_and_collide]], [[Vector2.bounce]], and [[Game Physics]] backlinks.
- Use vectors when the incoming direction or target movement is unclear.
- Use trigonometry when rotation, launch angle, or aiming arc becomes the next blocker.
- Use tilemap layout math when the bounce needs a readable room and camera view.
- Use the source-video notes workflow to preserve timestamps and test results beside the project.

## Related
- [Build a first Godot game loop](/projects/build-first-godot-game-loop/)
- [Sprite-animated 2D game loop](/learn/games/sprite-animated-2d-game-loop/)
- [Tilemap level layout math](/learn/games/tilemap-level-layout-math/)
- [Godot collision debugging basics](/learn/godot-collision-debugging-basics/)
- [Vectors for maker projects](/learn/vectors-for-maker-projects/)
- [Trigonometry for rotation and layout](/learn/trigonometry-for-rotation-and-layout/)
- [Calculus for game motion](/learn/math/calculus-for-game-motion/)
- [Turn source videos into notes](/video-notes/)
- [Review Anki-compatible decks](/decks/)

## Obsidian backlinks

Use these wiki links to connect this note inside a local maker vault:

- [[TopicLadder]]
- [[Maker Learning]]
- [[Collision Normal Bounce Math]]
- [[Games and Interactive Tools]]
- [[game-dev]]
- [[project-path]]
- [[Name the contact]]
- [[Draw incoming velocity]]
- [[Read the surface normal]]
- [[Scale the reflected vector]]
- [[Build a first Godot game loop]]
- [[Sprite-animated 2D game loop]]

## Source and next routes

Source: https://topicladder.com/learn/games/collision-normal-bounce-math/

- [Build a first Godot game loop](/projects/build-first-godot-game-loop/)
- [Sprite-animated 2D game loop](/learn/games/sprite-animated-2d-game-loop/)
- [Tilemap level layout math](/learn/games/tilemap-level-layout-math/)
- [Godot collision debugging basics](/learn/godot-collision-debugging-basics/)
- [Vectors for maker projects](/learn/vectors-for-maker-projects/)
- [Trigonometry for rotation and layout](/learn/trigonometry-for-rotation-and-layout/)
- [Calculus for game motion](/learn/math/calculus-for-game-motion/)
- [Turn source videos into notes](/video-notes/)
