Problem with the playerController

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Problem with the playerController

Postby Julio Jerez » Sun Nov 11, 2012 7:31 am

are you using the controller already in core 300?
if so the idea is that the controller will resolve the collision himself, by adding the impulese to the dynamics body.
Kinematic bodies are awere of all other kinamatic and dynamics bodies in teh scene, and they all contacts, so do dynamics bodies, it is just the dynamics bodies ignore the contact.
I have not demostarted that part yet in order of not to make to complex yet but all of the callbacks are in the controller but they are empty.

for what I get from your post, you are talking of and evasion move that the player should do when a body is going to hit him but I am not sure..
can I see a video? of what you have so that I have and idea of how to complete the demo with interation with other dynamics bodies?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby FSA » Sun Nov 11, 2012 1:52 pm

OK. PlayerController works. I think i also have this problem. When a body falls onto the player body nothing happend. It falls through the player body. I've made a picture.
Attachments
NoCollision.jpg
NoCollision.jpg (120.66 KiB) Viewed 3902 times
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Problem with the playerController

Postby Julio Jerez » Sun Nov 11, 2012 3:33 pm

For the player controller interation with other bodies, I was leaving that for the Advance controller.

Bascially the interation should happens on the PreUpdate callback oft the controller, but I left that empty for now.

I guess I can add a basic a behavior that apply an impulse to the incoming body. But in my experience that approach never satisfy every one.
for that Newton core 300 has the Newton AI library, which is a state machine and will have navigation and a closest distance calculation for implemeneting characters avoidance or character salutation, on that sort of stuff base on state and a graph.

bascially the play handle the collision, bu the elegant thing of a player controller is to make teh play smart enough that he does not rely in collision to navigate a map.

can you guy make a list of default behavior you would like to see on a player controller?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Neo » Mon Nov 12, 2012 12:38 am

Sorry for my late reply, my domitory shut the electricity during the night...
here's the video:
that sexy girl model is the player controller, I gave her a constant speed, and I'm controlling the tank
video here
At first, I let the player stand still (set speed to 0), It should be pushed away by my tank, but my tank go through it...
Then, I gave a constant speed to the player, it was indeed blocked by tank...but when I tried to use my tank to push it, they overlaped :(
Last edited by Neo on Mon Nov 12, 2012 1:09 am, edited 1 time in total.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Problem with the playerController

Postby Neo » Mon Nov 12, 2012 12:41 am

Well, for the default behavior of a player controller, I guess
stop,walk,jump and crouch is enough :D
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Problem with the playerController

Postby Julio Jerez » Mon Nov 12, 2012 9:09 am

I can not see the movie, can you make avi, or mpeg


Neo wrote:Well, for the default behavior of a player controller, I guess
stop,walk,jump and crouch is enough :D


it does that, chouch in not exposes yet but basically is just using the shape scale functionality, I will add that next.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Julio Jerez » Mon Nov 12, 2012 9:12 am

Neo wrote:At first, I let the player stand still (set speed to 0), It should be pushed away by my tank, but my tank go through it...(

I will add that as defualt behavior, howver that's not alway a well define preposition, what if the player is against a wall and the tank pushes him against the wall, but he cannot move any more, what should happen them?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Neo » Mon Nov 12, 2012 9:32 am

Julio Jerez wrote: what if the player is against a wall and the tank pushes him against the wall, but he cannot move any more, what should happen them?

neither of them can move....Just as 2 dynamic bodies do :mrgreen:
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Problem with the playerController

Postby Neo » Mon Nov 12, 2012 12:02 pm

Julio Jerez wrote:I can not see the movie, can you make avi, or mpeg

Ok, it took me long time to re-upload(only 17mb though)
Here's new video.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Problem with the playerController

Postby Julio Jerez » Mon Nov 12, 2012 12:14 pm

Oh I see, I can solve that very eassy.

also hwo are yo umaking you tank? after I comple the wheel vehicle, I am also adding a thack vehicle that will look like this.


I mean for real in game, also teh ineface is very similar to the Player controller.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Neo » Mon Nov 12, 2012 10:25 pm

Oh, I fear that my computer can not run that smoothly, so I'm using the 'inverse conveyor belt', which is mentioned in the a post long time ago, using material system to move.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Problem with the playerController

Postby Julio Jerez » Tue Nov 13, 2012 11:25 am

That ok the vehicle controller is lighwaigh vehicle, more expensive tha a raycast, bu much cheaoed that a full mutirigid body vehicle.
it should work on any core duo, or moder AMD CPU, what do you have?

but let us not get ahead of ourselft, I still need to solev teh player, and the vehicle first, then we tlak again when I have a tank demo to show.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Neo » Wed Nov 14, 2012 4:41 am

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 :(

BTW, how to modify the front direction of the controller? My front direction is z aixs, but change the matrix didn't work...
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Problem with the playerController

Postby Julio Jerez » Wed Nov 14, 2012 9:29 am

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);
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Neo » Wed Nov 14, 2012 1:12 pm

Julio Jerez wrote: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);

Yeah, It's actually what I did...But it didn't work. Previously, when I press the forward buttom, my player moves towards left. After modify the matrix like the one above, It still move toword left...
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest