reckfellENGINE

Jumping, stomping and bouncing

Jump velocity, contact normals and testing actual collisions after MoveAndSlide.

On this page

This uses the complete SquashPlayer.cs; jumping needs no extra script or duplicate signal connection.

Jump

IsActionJustPressed("jump") together with IsOnFloor() sets vertical velocity to JumpSpeed = 8. Holding Space does not jump every frame, and a new airborne press does not add velocity. Gravity 24 reduces vertical velocity with physics delta.

Before MoveAndSlide(), falling records downward movement. The collision may already clear vertical velocity afterward, making a test of the new Velocity.Y too late to identify the incoming fall.

Stomp

After movement, code reads GetSlideCollisionCount() and GetSlideCollision(i). A successful stomp needs all of these:

  • the character was falling before movement;
  • GetNormal().Y > 0.5, a predominantly upward contact normal;
  • the collider is a SquashMob;
  • TrySquash() returns true.

Comparing object heights alone is insufficient: a nearby lower object does not prove a collision. Ordinary floor contact awards no points because its collider is a StaticBody3D.

Bounce

A successful stomp sets BounceSpeed = 6 and keeps controls active. The method returns immediately so the same physics update cannot declare defeat from the area overlapping a hazard being deleted. Its flag and QueueFree() prevent duplicate score.

Expected result: landing on a cube's top earns one point and bounces the player upward. Side contact without the qualifying normal is not a stomp. See side-contact defeat.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.