Is `remap` in the documentation?

I just now had a hell of a time understanding if a map function existed or not. I discovered that there is (remap), but it’s apparently nowhere in the docs! Am I missing something?

Check arrays

What is remap but just another call to map?

1 Like

remap is a function that takes a value and “remaps” it from one range to another, using a inverse-lerp and a lerp. for example if I remap the value 0.5 given a starting range of 01 and a remapped range of 0256 I would get 128 as the result, because 0.5 is half of 0 to 1 so half of 0 to 256 is 128.

remap(0.5, 0, 1, 0, 256) # returns 128

You can ctrl+click any variable or function inside the Godot script editor to read it’s documentation or definition, or use F1 to find documentation in-editor.

6 Likes

I did not know that function existed! OMG, I spend so much time doing this ‘remapping’ all the time. I have so many ‘helper’ functions to do exactly this job. Wow. Thank you.

(I still can’t believe I never knew this existed.)

4 Likes

I’ll amend my post: apparently remap IS in the documentation, but you can’t find it because the docs search is useless. This is intensely frustrating. I mean yeah I see that @GlobalScope is the second search result but I expect the docs search would show the actual function as a search result. This is the kind of thing that turns people off of learning something.

@pennyloafers I wish you would have actually read my post. But probably you don’t know remap exists either, because the docs search is useless.

gertkeno Yeah, thanks, I already know what remap is. I’m pointing out that it’s impossible to find.

pauldrewett Thank you, glad to know I’m not the only one :slight_smile:

1 Like

I read it fine. You said map, and map is a common array functionality in many languages. Ill admit i dint know remap existed, i wish i had i wouldnt have been rolling my own transforms. but even in mathematical terms its just called map which is confusing to the general use case im use too in container manipulation.

Btw its simple and much easier to find methods in the editor.

Without even selecting methods its the first on the search list.

4 Likes

I was about to say this. I agree the web search sucks. Google “Godot 4 docs ” if you want to find it in the docs online. But if I want to look something up I always do it in the editor.

2 Likes