playMaker

Author Topic: Rigidbody velocity is 0, but Player moves equally  (Read 1757 times)

Bipolar

  • Junior Playmaker
  • **
  • Posts: 68
Rigidbody velocity is 0, but Player moves equally
« on: May 04, 2020, 03:56:36 PM »
Hi.

I recently met a problem with Playmaker.
The player movement is ok, but when inputs are pressed rapidly/at the same time, they can cause a bug: the rigidbody moves toward its forward also if no input keys are pressed.

Here's a video I recorded, as you can see the movement happens, but the velocity is zero, and I'm not setting forces from other FSMs.

I have to say, every time I make a FPS, I recycle the same project template to avoid the remake of the entire controller. Could it be the reason? Maybe I created some issues by modifying the same template more and more times?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigidbody velocity is 0, but Player moves equally
« Reply #1 on: May 05, 2020, 03:17:48 AM »
Hi,

 your video recording quality is too low, I can't read any of your variable names, so it's difficult to understand what you have done.

 can you reshoot it with hd quality?

Bye,

 Jean

Bipolar

  • Junior Playmaker
  • **
  • Posts: 68
Re: Rigidbody velocity is 0, but Player moves equally
« Reply #2 on: May 05, 2020, 08:50:37 AM »

I forgot to say if I shoot, the player returns to move normally, so the force is extinguished. Maybe because another force is applied, indeed when I use the ability "Double-barrel shotgun", there's a knockback that interrupts the bug.
« Last Edit: May 05, 2020, 09:18:30 AM by Bipolar »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigidbody velocity is 0, but Player moves equally
« Reply #3 on: May 06, 2020, 03:10:39 AM »
Hi,

few things:

- do not use GetProperty and SetProperty unless you have no other options, always prefer using regular action, for example, in your case, GetPosition will do just fine and will be more performant.

- I don't think you should use damper values when setting your animator float.

- why are you using getAxisRaw? use GetAxis action, that's fine for your use.

- your logic is odd, if you AddForce and at the same time set the velocity, one of these action is going to not operate properly, it's either you use forces, or either you control velocity.

Bye,

 Jean

Bipolar

  • Junior Playmaker
  • **
  • Posts: 68
Re: Rigidbody velocity is 0, but Player moves equally
« Reply #4 on: May 06, 2020, 04:13:34 AM »
Hi,

few things:

- do not use GetProperty and SetProperty unless you have no other options, always prefer using regular action, for example, in your case, GetPosition will do just fine and will be more performant.

- I don't think you should use damper values when setting your animator float.

- why are you using getAxisRaw? use GetAxis action, that's fine for your use.

- your logic is odd, if you AddForce and at the same time set the velocity, one of these action is going to not operate properly, it's either you use forces, or either you control velocity.

Bye,

 Jean

The reason why I used force for gravity and velocity for movement is I set the world gravity on 0,0,0 because I want to create a custom system to speed down the game time except for the player. I used Get axis raw to avoid interpolated movement or friction. Why get and set property should be used rarely? They are not performant? Anyway, I try to avoid them except for rare situations.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigidbody velocity is 0, but Player moves equally
« Reply #5 on: May 13, 2020, 01:59:23 AM »
Hi,

your custom system for physics sounds troublesome... :)

get and set property are not performant because they use code reflection and that's not as good as when you use a regular action referring to class and methods directly.

Bye,

 Jean