hey, it's me again
i'm trying to make character controller work with test silent hill 2 level, but it crashes there[i attached the images], because shape is NULL
i can't generate dump, because it crashes internally on character:postupdate
i will dump level for you to test
newton version: latest svn(10.05.15)[crashes on old one as well]
dump: http://109.120.172.56/scene.rar
image: http://ft.trillian.im/c9088c8252fc7b02b ... cR1PwU.jpg
test code
- Code: Select all
class BasicPlayerControllerManager : public CustomPlayerControllerManager
{
public:
BasicPlayerControllerManager(NewtonWorld* const world)
:CustomPlayerControllerManager(world)
{
}
~BasicPlayerControllerManager()
{
}
// apply gravity
virtual void ApplyPlayerMove(CustomPlayerController* const controller, dFloat timestep)
{
/*NewtonBody* const body = controller->GetBody();
iNWActor *ac = (iNWActor*)NewtonBodyGetUserData(body);
CNWPlayer* const player = (CNWPlayer*)ac->user_data;
// calculate desired linear and angular velocity form the input
dVector gravity(0.0f, DEMO_GRAVITY, 0.0f, 0.0f);
auto &CTR = player->CTR;
// set player linear and angular velocity
controller->SetPlayerVelocity(CTR.m_forwarSpeed, CTR.m_strafeSpeed, CTR.m_jumpSpeed, CTR.m_headinAngle, gravity, timestep);*/
}
virtual int ProcessContacts(const CustomPlayerController* const controller, NewtonWorldConvexCastReturnInfo* const contacts, int count) const
{
count = CustomPlayerControllerManager::ProcessContacts(controller, contacts, count);
return count;
}
};
HRESULT CNWPlayer::Create(iNWScene *Scene, float radius, float height, float radius2, float height2, e3d_V3 IntPos)
{
NewtonWorld* world = (NewtonWorld*)Scene->GetScene();
// create a character controller manager
BasicPlayerControllerManager* const playerManager = new BasicPlayerControllerManager(world);
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);
// make the player controller, this function makes a kinematic body
m_controller = playerManager->CreatePlayer(CFG.Mass, radius, radius2, height, height2, playerAxis);
//m_controller = manager->CreatePlayer(200.0f, 0.4207f, 0.105f, 2.0f, 0.5, playerAxis);
// set a restraining distance that the player can not get closet than
m_controller->SetRestrainingDistance(0.1f);
// get body from player, and set some parameter
NewtonBody* const body = m_controller->GetBody();
ac = CRG(iNWActor);
ac->SetBody(body);
ac->user_data = this;
D3DXMATRIX m;
D3DXMatrixIdentity(&m);
// set the player matrix
NewtonBodySetMatrix(body, &m.m[0][0]);
return S_OK;
}