[Help] Physics and States

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

forrestmark9

FNG / Fresh Meat
Nov 29, 2011
1,110
40
0
Are there functions present in the Pawn or Controller that are called if the state is changed or if the physics are changed? That way I can do checks there if they change instead of in timer or tick
 

poosh

Grizzled Veteran
Jan 6, 2011
3,403
327
83
Well, you can extend PlayerController.LongClientAdjustPosition().

But why tick is bad? You should't underestimate performance of modern hardware. Or even performance of 10-year-old PC. Adding a few extra checks in every tick won't have any impact on performance at all.
 

Skell

Active member
Mar 21, 2013
1,245
2
38
On the Internet.
Are there functions present in the Pawn or Controller that are called if the state is changed or if the physics are changed? That way I can do checks there if they change instead of in timer or tick
Apart from going in to every function and checking to see where it sets physics, it looks like no...

The best thing to do would be using GetPhysicsString() to find out if it changes each tick, but that's not what you're looking for.

If that's the way you wanna go, GetPhysicsString() is in xPlayer, which is a parent of KFPlayerController.
 

Dr_Killjoy

FNG / Fresh Meat
Sep 30, 2012
260
0
0
Tick is the best way. If you don't like just checking in tick and doing smth, check physics in tick and then call your own event.
 

forrestmark9

FNG / Fresh Meat
Nov 29, 2011
1,110
40
0
Well, you can extend PlayerController.LongClientAdjustPosition().

But why tick is bad? You should't underestimate performance of modern hardware. Or even performance of 10-year-old PC. Adding a few extra checks in every tick won't have any impact on performance at all.

Well with the amoutn of things running already I need the best performance and I see constantly checking the pawn physics and controller state every tick is kinda slow
 

Dr_Killjoy

FNG / Fresh Meat
Sep 30, 2012
260
0
0
Well with the amoutn of things running already I need the best performance and I see constantly checking the pawn physics and controller state every tick is kinda slow

Are you kidding? Checking enum values is slow? You can save state in some int value, changing its code when you enter each state - yes it's kinda lame but it will eliminate need in calling GetStateName function.
 

poosh

Grizzled Veteran
Jan 6, 2011
3,403
327
83
Well with the amoutn of things running already I need the best performance and I see constantly checking the pawn physics and controller state every tick is kinda slow
Dude, do you realize that it is a matter of only a few nanoseconds of CPU time?..
 

forrestmark9

FNG / Fresh Meat
Nov 29, 2011
1,110
40
0
Dude, do you realize that it is a matter of only a few nanoseconds of CPU time?..

I know since there isn't any function for what I'm asking I just do it in timer every 0.1 seconds, the change doesn't need to be instant just fast enough to where they won't notice the change