Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2019, 3:32:40 PM (6 years ago)
Author:
pomselj
Message:

bounces moore smoothly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc

    r12356 r12360  
    6767        this->relMercyOffset_ = 0.05f;
    6868        this->orxoblox_ = this->getOrxoBlox();
     69        this->radius_ = 1.5;
    6970
    7071        this->registerVariables();
     
    302303        Vector3 myPosition = this->getPosition();
    303304        orxout() << "About to Bounce >D" << endl;
    304         //if (positionOtherObject.y < 0) {
    305             //this.destroy()
    306         //}S
    307         //else {
    308305       
    309306            int distance_X = myPosition.x - positionStone.x;
     
    322319            if (distance_X < distance_Z) {
    323320                velocity.z = -velocity.z;
    324                 orxout() << "z" << endl;
     321                orxout() << "z" << endl; 
    325322            }
    326             if (distance_Z < distance_X) {
     323            else if (distance_Z < distance_X) {
    327324                velocity.x = -velocity.x;
    328                 orxout() << "x" << endl;
     325                orxout() << "x" << endl;       
    329326            }
    330327            else {
     
    332329                velocity.z = -velocity.z;
    333330                orxout() << "both" << endl;
    334             }
     331            }                                 
     332
    335333            this->setVelocity(velocity);
     334            this->setPosition(myPosition);
    336335    }
    337336
     
    346345        Bounce(Stone);
    347346        //if(otherObject->getHealth() <= 0) {
    348             Stone->destroy();
     347        Stone->destroy();
     348
    349349        //}
    350350        //otherObject->reduceHealth();
     
    362362    }
    363363
     364    float OrxoBloxBall::getRadius() {
     365        return this->radius_;
     366    }
     367
    364368
    365369}
Note: See TracChangeset for help on using the changeset viewer.