0 votes

Im distributing X nodes from point A to point B in a linear way, more especifically like this.

var rotate.origin = 90
var rotate.ending = 180
var bullet.amount = 10.0

var rotate.angle = (rotate.ending - rotate.origin) / bullet.amount

In this case (180 - 90) / 10 = 9.

I'll evenly spawn nodes with a diference of 9 degrees.

But I want to spawn them in a non linear way, going from small steps to bigger steps or viceversa, thats why i think an exponential function could help, but i don't know how to apply it.

Can some one explain it to me?

Godot version 3.2.3
in Engine by (106 points)

1 Answer

0 votes
Best answer
for x in range(bullet.amount) :
      rotateangle /= 2

This will be pretty much exponential. If You are going to spawn bullets in forms of different functions, check out Curve2D. If not, just experiment with your calculations ;)

by (8,101 points)
selected by

thanks dude, that was easier than I thought, I Just want to add that the way rotate angle should be defined will be diferent.

rotate.angle = rotate.ending - rotate.origin

then your code snippet does the trick

for x in range(bullet.amount) :
      rotate.angle /= 2
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.