Neo wrote:There's some coordinate error bitween visual object and player controller, later I found that.
Controller is on the floor while visual object 'sank' into the floor a quarter...
Previously, using CreateCustomePlayerController, I can solve it by set translation part of the matrix before create the cylinder.
However, this time, when I turn to CuntomPlayerControllerMananger, change the translation part makes no difference : .
The origin of the controller is the lower bottom the player high, is not that what everyone uses? I can make that an option, but I found that most people prefer it that way.
if you can not make you player with the origon at the lower bottom, I can add a funtion to set the origin. Bu I thonk it is much eassy to simpler to savethe play with it origon on the righ place.
Neo wrote:BTW, how to modify the front direction of the controller? My front direction is z aixs, but change the matrix didn't work...
the function
CustomPlayerControllerManager::CustomController* CustomPlayerControllerManager::CreatePlayer (dFloat outerRadius, dFloat innerRadius, dFloat height, dFloat stairStep, const dMatrix& localAxis)
take the local axis of the player as an argument, in the demo I use x as front vector
- Code: Select all
// now make a simple player controller,
dMatrix playerAxis;
playerAxis[0] = dVector (0.0f, 1.0f, 0.0f, 0.0f); // the y axis is the character up vector
playerAxis[1] = dVector (1.0f, 0.0f, 0.0f, 0.0f); // the x axis is the character front direction
playerAxis[2] = playerAxis[0] * playerAxis[1];
playerAxis[3] = dVector (0.0f, 0.0f, 0.0f, 1.0f);
if you want it to move along z as principal axis, you can do this
- Code: Select all
// now make a simple player controller,
dMatrix playerAxis;
playerAxis[0] = dVector (0.0f, 1.0f, 0.0f, 0.0f); // the y axis is the character up vector
playerAxis[1] = dVector (0.0f, 0.0f, 1.0f, 0.0f); // the x axis is the character front direction
playerAxis[2] = playerAxis[0] * playerAxis[1];
playerAxis[3] = dVector (0.0f, 0.0f, 0.0f, 1.0f);
// make the player controller, this function makes a kinematic body
m_controller = manager->CreatePlayer(radius, radius * 0.5f, height, height * 0.33f, playerAxis);