The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I'm working on a calculator that automatically solves a simple equation that I'm learning in a stock trading course where you plug in some numbers from a real graph and it calculates a few numbers for you.

I'm trying to simulate a small section of real stock chart as a visual aid and using the points of a line 2D.

Here is the code I'm using to distribute the points:

midpoint = $VSlider.value

line_2d.set_point_position(0,Vector2(line_2d.get_point_position(0).x,(-L1) - (midpoint) + offset
))
line_2d.set_point_position(1,Vector2(line_2d.get_point_position(1).x,(-H1) - (midpoint) + offset
))
line_2d.set_point_position(2,Vector2(line_2d.get_point_position(2).x,(-L2) - (midpoint) + offset
))
line_2d.set_point_position(3,Vector2(line_2d.get_point_position(3).x,(-H2) - (midpoint) + offset
))
line_2d.set_point_position(4,Vector2(line_2d.get_point_position(4).x,(-L3) - (midpoint) + offset
))
line_2d.set_point_position(5,Vector2(line_2d.get_point_position(5).x,(-value) - (midpoint) + offset
))

(The midpoint variable is just to slide the whole thing up or down because some values will put if off the screen)

The problem is that I need a was to amplify the difference between these points, ideally controlled by a slider . Depending on the numbers I put in, the line almost looks straight because the values are so relatively similar. I need to control making the peaks higher and the valleys lower dynamically.

Godot version 4.0
in Engine by (17 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.