Skip to content
Bit Quirky Round Trip
Visual Scripting

Search documentation

All topics and APIs

Close returns focus to Search.

What are you looking for?

Try a common topic or enter a complete API identifier.

Browse the reference instead

Esc closes · Tab reaches results · Enter opens the focused link

v0.89.0
Menu

Scan a list

Follow a for loop that examines collision contacts and stops at the first upward-facing normal.

A collision can contain several contact points. PlayerMotor.UpdateGrounded scans them until one normal points up past the grounding threshold.

Using only the first contact can miss the floor when the player touches a corner. The motor must inspect each contact, but it can stop as soon as one proves the player is grounded.

  • A collection must be inspected one item at a time.
  • Finding the first match is enough.
  • Work can stop as soon as that match appears.
The UpdateGrounded graph with its for loop and upward-normal branch.
Figure 1. The loop checks each contact normal and returns after the first grounding match.
  1. Open PlayerMotor.UpdateGrounded in Graph View.

  2. Read the for-loop controls: i starts at zero, continues while it is less than collision.contactCount, and increments once per pass.

  3. Inside the loop, follow i into collision.GetContact(i), then read the contact’s normal.y value.

  4. Follow the branch that compares normal.y with GroundNormalThreshold.

  5. Follow the true path. It sets _grounded to true, then returns before another contact is read.

  6. Follow the false path back to the loop. The next contact is checked until one passes or the collection is exhausted.

The current Platformer method is:

The return ends the method immediately. If no contact passes the threshold, the loop completes without setting _grounded.

When it goes wrong

SymptomCheckFix
Only the first contact is checked.Follow the loop condition and iterator back edge.Keep GetContact inside the loop and feed it the current i value.
A wall contact marks the player grounded.Read the comparison against GroundNormalThreshold.Keep the upward-normal threshold on the true path before setting _grounded.
Contacts continue to be checked after ground is found.Trace execution after the _grounded assignment.Connect the return directly after setting _grounded.
  • Loops: read initializer, condition, iterator, and body.
  • Return and throw: follow the early exit from the loop body.
  • Get and set: follow the write to _grounded.
Full-size image