Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri May 11, 2012 12:19 am 
Offline

Joined: Fri May 11, 2012 12:15 am
Posts: 1
Hi all,

I am using btKinematicCharacterController and it all works perfectly for walking and rotating. Can anyone give me any hints or references on how to add strafing. The code at the moment is:

Code:
btTransform xForm;
        xForm = ghostObject->getWorldTransform();
       
        btVector3 forwardDir = xForm.getBasis()[2];
        btVector3 upDir = xForm.getBasis()[1];
        btVector3 strafeDir = xForm.getBasis()[0];
        forwardDir.normalize();
        upDir.normalize();
        strafeDir.normalize();
       
        btVector3 walkDirection = btVector3(0.0,0.0,0.0);
        btScalar walkVelocity = btScalar(1.1) * 6.0 * -playerLocationControl.y;
       
        btScalar walkSpeed = walkVelocity * dt;
       
    if (playerLocationControl.x) {
       
    }
    if ( playerLocationControl.y) {
        walkDirection +=forwardDir;
    }
    characterController->setWalkDirection(walkDirection*walkSpeed);
   
    if ( playerDirectionControl.x) {
        btMatrix3x3 orn = ghostObject->getWorldTransform().getBasis();
        orn *= btMatrix3x3(btQuaternion(btVector3(0,1,0), 0.02 * playerDirectionControl.x));
        ghostObject->getWorldTransform().setBasis(orn);
    }
    if ( playerDirectionControl.y) {
    }


Thanks,

Dave


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group