Jump to content

Math problem for you...


robhol

Recommended Posts

OK, so I could use a function where I give two points (X,Y,Z) and a value (e.g. percent) and get a point back that's x% "on the way" from point A to point B.

That probably didn't make too much sense, so please ask if you're wondering what the hell I'm babbling about.

Link to comment

you mean like a point just a percent between two points starting from first?

I dunno if this would work but I'd try it first

  
function getPoint(X, Y, Z, XX, YY, ZZ, percent) 
    local newX = (XX - X) * percent + X 
    local newY = (YY - Y) * percent + Y 
    local newZ = (ZZ - Z) * percent + Z 
    return newX, newY, newZ 
end 
  

Something like this? I haven't tested it but it should work

Edited it a bit as you pointed to my error

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...