[DELETE]ConvexRayCast crash

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

[DELETE]ConvexRayCast crash

Postby e3dalive » Sun May 10, 2015 7:51 am

Turns out it was too little size in character.

hey, it's me again :D
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;
}
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: [DELETE]ConvexRayCast crash

Postby Julio Jerez » Mon May 11, 2015 1:35 pm

I am looking at this now.
questions:
-has you updated? what version are you on?
-where do you paste the code?

Oh did you delete the bug?
did you get it going
Julio Jerez
Moderator
Moderator
 
Posts: 11045
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [DELETE]ConvexRayCast crash

Postby e3dalive » Mon May 11, 2015 1:46 pm

i tested it with debug version, and there was an assert in character creation[the size was too small]. I fixed it and got it working. I marked this topic for deletion.
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 2 guests