Basic Character Controller Questions & Issues

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Basic Character Controller Questions & Issues

Postby Crashy » Fri Apr 15, 2016 5:41 pm

I've just downloaded a fresh and up to date version of newton from github.

In AdvancedPlayerController.cpp, I've changed the size of the spawned props to
Code: Select all
dVector size (2.0f, 2.0f, 2.0f, 0.0f);

Their mass is still set to 30.0f

Then, just start the demos, press enter to spawn some props.
At this point, if you try to push one of the prop, you can't, except if the prop geometry allows it to touch the support shape.

In the attached screenshot, I cannot push the sphere at all.
Attachments
sample.jpg
sample.jpg (30.53 KiB) Viewed 3497 times
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Basic Character Controller Questions & Issues

Postby Julio Jerez » Fri Apr 15, 2016 6:35 pm

ok, I will try to repeat that test tonight and see what is going on, I can't do it now.

can you please describe he behavior that you are looking for?
Basically you want to be able to push the ball?
can the Ball push the player?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Basic Character Controller Questions & Issues

Postby Crashy » Sat Apr 16, 2016 1:57 am

Thanks.

Basically you want to be able to push the ball? -> Yes
can the Ball push the player? -> No
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Basic Character Controller Questions & Issues

Postby Julio Jerez » Mon Apr 18, 2016 12:40 am

Oh I see my explanation was not clear enough.
what I said is that in your system you need to implement function int ProcessContacts (..)
in the demo my version does not reject any contact but if you reject any contact, the player will collide with the object reported but the contact.
Basically the player controller is a filter that has the ability to process some contacts in some special way. but if the contact is rejected then the low level collision system handle it. You can see this behavior when the player goes over the bridge. The bridge plank reacts to the player weight.

I did not add any filter example because must people want the opposite of what you want, the do not want the player to push objects.

I now added a rejection test that allow the player to push the big the ball, but the ball has not effect on him.
Code: Select all
   virtual int ProcessContacts (const CustomPlayerController* const controller, NewtonWorldConvexCastReturnInfo* const contacts, int count) const
   {
      // here you need to process the contact and reject the one you do not need.
      //there are different ways to do this:
      // 1-by assigning a collision ID to the colliding shape in the contact
      // 2-by using the material system
      // 3-by getting the user data from the shape or from the body and using any labeling system of the client application
      // 4- by using any king of heuristic
      // if a contact is rejected then the [alway body will client with the object in the background and the collision system will take place
      // for simplicity I will use the heuristic that I will let the 

      int newCount = count;
      for (int i = count - 1; i >= 0; i --) {
         const NewtonBody* const hitBody = contacts[i].m_hitBody;
         dFloat Ixx;
         dFloat Iyy;
         dFloat Izz;
         dFloat mass;
         NewtonBodyGetMassMatrix(hitBody, &mass, &Ixx, &Iyy, &Izz);
         if (mass > 0.0f) {
            contacts[i] = contacts[newCount - 1];
            newCount --;
         }
      }
      count = CustomPlayerControllerManager::ProcessContacts (controller, contacts, newCount);
      return count;
   }


please let me know if this is what you want.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Basic Character Controller Questions & Issues

Postby Crashy » Mon Apr 18, 2016 1:05 am

This works ! Thank you so much ! :!:
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron