Moving character controller

saneeshnair
Posts: 11
Joined: Thu Apr 07, 2011 5:59 am

Moving character controller

Post by saneeshnair »

Hi All,
I implemented the character controller inside the sample environment given by bullet. Now I noticed the

Code: Select all

virtual void updateCamera();
function. I don't want my camera to rotate when I am controlling the character. So I removed that part from the code. Now as you all may know the character is not moving as expected.

If I rotate my character to the left and press forward I want the character to move straight in the rotated direction but it is moving in the opposite direction. Can anyone tell me what change should I make in the

Code: Select all

virtual void clientMoveAndDisplay();
to get the result I needed.

Many Thanks,
Saneesh
saneeshnair
Posts: 11
Joined: Thu Apr 07, 2011 5:59 am

Re: Moving character controller

Post by saneeshnair »

Code: Select all

forwardDir.setX((forwardDir.getX()* -cos((float)1)));
			forwardDir.setY((forwardDir.getY()* -sin((float)1)));
With these two lines I have achieved my required movement. Please comment if this has any problem. Rest of the code is same as in Bullet character controller demo. I removed the UpdateCamera function also.

Regards,
Saneesh