Facepunch / sbox-issues

175 stars 12 forks source link

Curve editor missing X range inputs #5265

Open krotter0 opened 5 months ago

krotter0 commented 5 months ago

For?

S&Box

What can't you do?

The curve editor is missing input fields for the X range, even though it's something that curves can handle. It'd be nice to be able to change it.

How would you like it to work?

img

What have you tried?

Editing the editor code in base.

Additional context

I'm pretty sure this wasn't missing a while ago, since I have some old projects which rely on the x range of curves.

aylaylay commented 5 months ago

Probably one for @garrynewman I'm not sure why the properties for time range is missing, probably because curve editor is mostly used for particles and the time range is usually 0-1?

garrynewman commented 5 months ago

Yeah normalized time is on purpose. That isn't really what this is used for.. and although it could be adapted, we'd need a really good reason to do it

krotter0 commented 5 months ago

One of my main uses was for a vehicle controller, where the x axis was used for speed, rpm or any other parameter and y for some force output: cttorq ctgrcrvs (Source: Car Physics for Games by Marco Monster)

More recently, I was missing this when I was making a physics player controller, where I wanted to lower the player's acceleration when they already had a lot of speed. A curve allowed me to quicky tweak this setting in the inspector, but I had to introduce a vector2 property which is used just for remapping the player's speed to a value between 0-1. I had to change two different values for the same thing.

I also made a player sound component for this same project, which uses curves similarly - they take the player's speed for x and output the sound's pitch/volume on y.