Topic: Path Finding Code (Question)

Hi. So, I think you can use a bezier curve formula to get an object to follow a curve, so I found this code:

http://giderosmobile.com/forum/discussi … ve-code/p1

Think I could use this with Maratis if I make the points vec3 coordinates?

Re: Path Finding Code (Question)

Perhaps this will help me:
http://www.cs.bham.ac.uk/~slb/courses/Graphics/g88.html

We will see

Or this:

http://www.geometrictools.com/Documenta … dSpeed.pdf

Last edited by Tutorial Doctor (2014-04-28 18:24:41)

Re: Path Finding Code (Question)

Hi,
all this will be useful for an object to follow a specific smooth path.
you will still need a "path finding" algorithm, like Recast : https://github.com/memononen/recastnavigation

Re: Path Finding Code (Question)

Here are are some functions I made that make an object follow a few types of curves, like sine curves, artangent curves, and even a circle as a parametric curve.

I think I would have to do some type of parametric curve fitting.

--Outside the onSceneUpdate() function
u=0
ground = 2
center = vec3{0,0,ground}
x = u 
y = 0
drag = 5

--These functions called inside the onSceneUpdate() function

function Sinuside(object)
    u = u + 1
        
    x = u/drag 
    y = 9*math.sin(x)
        
    path = vec3(x,y,ground)

    setPosition(object,path)
end

function Cosinide(object)
    u = u + 1
        
    x = u/drag 
    y = 9*math.cos(x)
        
    path = vec3(x,y,ground)

    setPosition(object,path)
end

function Arctangic(object)
    u = u + 1
        
    x = u/drag 
    y = 9*math.atan(x)
        
    path = vec3(x,y,ground)

    setPosition(object,path)
end

function ArcSinusidal(object)
    u = u + 1
        
    x = u/drag 
    y = math.asin(x/60)
        
    path = vec3(x,y,ground)

    setPosition(object,path)
end

--x = r cos(t)    y = r sin(t)


function Circulate(object,radius,speed)
    u = u + speed
        
    x = speed * radius * math.cos(u)
    y = speed * radius * math.sin(u)
        
    path = vec3(x,y,ground)

    setPosition(object,path)
end

function Elipticate(object,width,height)
    u = u + .1
        
    x = width * math.cos(u)
    y = height * math.sin(u)
        
    path = vec3(x,y,ground)

    setPosition(object,path)
end

Last edited by Tutorial Doctor (2014-04-28 20:12:56)

Re: Path Finding Code (Question)

I think this parametric equation will work:

http://lima.osu.edu/people/iboyadzhiev/ … etric.html

Re: Path Finding Code (Question)

I think I was mistaken. It seems a path finding algorithm would find the "shortest path" from one location to another. This is not what I was looking for, but just a way to get an object to follow a path. Of course, now this makes me want to work on the path finding thing. Although I might just use my senses system for navigation.