Cant get my Player to move properly in the World

Started by sushobhit, August 20, 2014, 08:16:24 AM

Previous topic - Next topic

sushobhit

Hi Friends ,

Please tell me what I am doing wrong here ????
My player's rotation is controlled by Mouse dx
and move forward is done when the UP key is pressed.

Now during the start the first time when I press the UP key the player moves in the desired direction..
But after that when I roatate the player using the mouse and press the Up key it first goes a little in the last Direction
it moved to and then it goes in the right direction.

What changes should I make.

   

SimpleVector t= box.getZAxis();
t.scalarMul(0.05f);
moveRes.add(t);
moveRes = box.checkForCollisionEllipsoid(moveRes, ellipsoid, 8);
box.translate(moveRes);


Also I am using a little code just after this in the gameloop for Gravity I hope its not this that is causing the problem....

// finally apply the gravity:
         SimpleVector t = new SimpleVector(0, 1, 0);
         t = box.checkForCollisionEllipsoid(t, ellipsoidG, 10);
         box.translate(t);
The value of ellipsoid as follows :


private SimpleVector ellipsoid = new SimpleVector(2, 2, 2);
   private SimpleVector ellipsoidG = new SimpleVector(2, 20, 2);

EgonOlsen


sushobhit

moveRes is initially set at 0,0,0
cause the initial position of the player is 0,0,0

i.e the Origin and then it stores the Translation as the Player moves

i.e the current position of the Player ???


EgonOlsen

In that case, your code snippet doesn't make much sense to me. Translations are cumulative, i.e. the translation vector that you apply to the box as well as to the collision detection method should actually be the direction vector from the box's current position to the new one. Not the one from it's initial position to the new end position.

sushobhit

thank you for helping ..

but i got it already up and running using collision det in wiki example..
and the character is doing much better yhan expected he is even climbing stairs very smoothly

sorry i didnt study 3d vectors during high school as a result i am suffering now..

but already i have downloaded few good tuts on 3d maths and started learning about normals , the cross and dot etc etc

hope i wont bother you much in the future once i have completed these studies..


by the way last night i registered and downloaded aptalkarga but when i logged in i found myself alone in the village and nobody was there in the mushroom bar too , i there somewhere else the action is going on or is the software not being used anymore ????