 Author Topic:  Slerp formula  (Read 274 times)

0 Members and 1 Guest are viewing this topic.

Phearcia Slerp formula
« on: September 07, 2016, 07:32:45 AM »
How would I code this...lol.

I'm trying to make homing missles. In a particle emitter, would the velocity be the output of the sleep formula.

Here's what I got so far.

[xc] = [pos:x]
[yc] = [pos:y]
[zc] = [pos:z]

Intersect ray
Context target

[xt] = [prel:x]
[yt] = [prel:y]
[zt] = [prel:z]
Context player

Dryym Re: Slerp formula
« Reply #1 on: September 07, 2016, 07:43:07 AM »
I don't know exactly what you said, But I got homing missiles.

In order to do proper homing missiles, I think you would have to set up a pseudo velocity that would determine how long they take to turn.

The way I would do it is to use vectors and plot out the path first, Then worry about the particles.

Once you have a path working quite well, You can make the particles using this
How do you set up a script with the particle command so that the particle will travel to a specified coordinate?
Particles use a velocity, which is a direction vector with a magnitude of the required speed.

direction = destination position - source position;

direction's magnitude is now the distance between source and destination.

If you want the particle to travel from source to destination in constant time regardless of the distance between the two points, then this direction vector is what you want, just multiple it by some factor to adjust the speed as required.

If you want the particle to travel from source to destination at constant speed, i.e. the further the distance, the longer it takes the particle to get there, then you need to normalize direction (which you know how to do) and multiply it by your desired speed.

Also, Be sure to add a wait for T MS after each particle and before each intersect. T is the distance to the target divided by the rate of the particle. It is also the variable that will show how long the particle lasts.  Creator of the term "Deathmine ©"
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

Phearcia Re: Slerp formula
« Reply #2 on: September 07, 2016, 08:12:13 AM »
Aaaaah... I see... The xyz is the start point and the velocity is the x2y2z2. The particles are kinda like the slerp formula already.

http://allenchou.net/2014/04/game-math-quaternion-basics/
« Last Edit: September 07, 2016, 10:14:01 AM by Phearcia »