Results 1 to 4 of 4

Thread: [AI movement] Jumping using movegravity()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    I have also wrote a sqrt function, its accurate to 6 decimals:
    PHP Code:
    sqrt)
    {
        
    0;
        for ( 
    1<= 1000000*= 10 )
        {
            while ( 
    <= )
                
    += (i);

            if ( 
    )
                
    -= (i);
        }

        return 
    a;

    To increase the accuracy write a bigger number in 'for' cycle.

    And an other mathematical function:
    PHP Code:
    vectorCross(vec1vec2)
    {
        
    result =
        (
    vec1[1]*vec2[2] - vec2[1]*vec1[2]) -
        (
    vec1[0]*vec2[2] - vec2[0]*vec1[2]) +
        (
    vec1[0]*vec2[1] - vec2[0]*vec1[1]);

        return 
    result;


  2. The Following 2 Users Say Thank You to randall For This Useful Post:

    kung foo man (18th May 2013),Ni3ls (18th May 2013)

  3. #2
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by randall View Post
    I have also wrote a sqrt function...
    my one:
    PHP Code:
    sqrt)
    {
        
    x;

        for( 
    *0.25 abs) >= 0.001 = ( + ( ) ) * 0.5 )
        {
            
    y;
        }

        return 
    y;


  4. The Following 3 Users Say Thank You to serthy For This Useful Post:

    kung foo man (19th May 2013),Ni3ls (19th May 2013),randall (20th May 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •