Skip to content

Remap function returns nan and inf #1157

@Shadowblitz16

Description

@Shadowblitz16

Tested versions

Reproducible in v4.4.stable.mono.official [e36cb51]

System information

Operating System: Debian GNU/Linux 13 KDE Plasma Version: 6.3.6 KDE Frameworks Version: 6.13.0 Qt Version: 6.8.2 Kernel Version: 6.12.57+deb13-amd64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5700G with Radeon Graphics Memory: 16 GiB of RAM (11.6 GiB usable) Graphics Processor: AMD Radeon Graphics

Issue description

The remap math function returns nan and inf in valid cases making the function useless.

Steps to reproduce

Look at this code after you download the project and run it...

	var animation_speed := remap(player.velocity.x, 0.0, signf(player.direction) * walk_velocity_max, 0.0, 1.0)
	if  animation_speed == NAN: animation_speed = 0.0
	print(animation_speed)

Minimal reproduction project (MRP)

zelda-aol-arena.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions