Player Movement
by Gotland_0001 · in Torque Game Engine · 05/15/2006 (9:23 am) · 0 replies
I hope someone can help me a bit here, I am trying to manipulate the players movement in the game because we will have what we call "attractive objects" in the world that will interest the players mount.
So I intend to make them pull towards that position and the player has to counter act that movement.
I have managed to isolate the code below in "void FlyingVehicle::updateForces(F32 /*dt*/)" and I have tracked the values by using the console in the game (Con::printf("bla bla");) but I got a bit confused and I am not really sure what the values in steering.x and steering.y stands for... I need to change the direction but these where incredibly small values... can maybe someone shed some ligt on the problem for me and I don't mind if they tell me at the same time how to convert either radians or degrees to that kind of value =)
UPDATE
steering.x and steering.y has a value of 0.000000 when standing still, no surprise there because it means no change is taking place.... but when you start moving the mouse it changes to as most +/- 0.000541 (that I have been able to register).
torque (.X, .Y, .Z) is similar... has 0.000000 for no change but went +/- 2.483817...
I know I am lacking some math in my head because I have not played around with this kind of stuff latley so it might be something more simple then I think...
Help is really appreciated on this problem
- Patrik
So I intend to make them pull towards that position and the player has to counter act that movement.
I have managed to isolate the code below in "void FlyingVehicle::updateForces(F32 /*dt*/)" and I have tracked the values by using the console in the game (Con::printf("bla bla");) but I got a bit confused and I am not really sure what the values in steering.x and steering.y stands for... I need to change the direction but these where incredibly small values... can maybe someone shed some ligt on the problem for me and I don't mind if they tell me at the same time how to convert either radians or degrees to that kind of value =)
Point2F steering; [b]steering.x[/b] = mSteering.x / mDataBlock->maxSteeringAngle; // HERE z - axis rotation [b]steering.x[/b] *= mFabs(steering.x); [b]steering.y[/b] = mSteering.y / mDataBlock->maxSteeringAngle; // AND HERE x - axis rotation [b]steering.y[/b] *= mFabs(steering.y); torque -= xv * steering.y * mDataBlock->steeringForce; torque -= zv * steering.x * mDataBlock->steeringForce;
UPDATE
steering.x and steering.y has a value of 0.000000 when standing still, no surprise there because it means no change is taking place.... but when you start moving the mouse it changes to as most +/- 0.000541 (that I have been able to register).
torque (.X, .Y, .Z) is similar... has 0.000000 for no change but went +/- 2.483817...
I know I am lacking some math in my head because I have not played around with this kind of stuff latley so it might be something more simple then I think...
Help is really appreciated on this problem
- Patrik