[I already asked this question on the UDK forums, without much success though.]

I'm using a class derived from AIController to control my pawn in RTS-style. My problem is that the pawn does not have a fixed Location.Z so if his Velocity in X and Y direction changes the Velocity.Z also changes (for whatever reason). I have tried nulling the Velocity.Z in the tick method, using Move to move the character back to a constant height and some other things of which nothing had worked. How can I solve this?

  • \$\begingroup\$ Maybe a silly question: is the pawn on the ground? Asked another way: is the Z velocity not caused by gravity? \$\endgroup\$ – Phillip Jan 8 '13 at 7:57
  • \$\begingroup\$ Yes it is on the ground. The Z velocity is 0 until I change the velocity of the pawn in X and Y direction which makes it jump and finally fall back on the ground. \$\endgroup\$ – Torax Jan 8 '13 at 19:17
  • \$\begingroup\$ Oh, so the Z vel is positive! Wow. How/where are you changing the Pawn's Velocity? Can you post some sample code? \$\endgroup\$ – Phillip Jan 8 '13 at 20:39
  • \$\begingroup\$ I tried setting the Velocity directly but what I'm doing now is applying momentum to it using the TakeDamage method like this TargetPawn.TakeDamage(10, SomeController, TargetPawn.Location, Momentum, class'DamageType',, Self); where Momentum is a vector with its Z component set to 0. Both have the same result of also making the pawn lift off even though the added velocity/momentum in Z direction was 0. \$\endgroup\$ – Torax Jan 11 '13 at 0:03
  • \$\begingroup\$ Unfortunately, I'm not really sure what's going on. I've got March 2012 UDK. I just tried using an Actor Factory to spawn an AIController/Pawn and using an exec function to set its Velocity to vect(200,100,0) and I didn't get any Z velocity. Are you using a Physics other than PHYS_Walking? Setting the velocity anywhere else inside your Controller or Pawn? I'd say stick logs in directly before and after you set Velocity. Also if you haven't already, use an exec function to do nothing more than set the Pawn's Velocity. \$\endgroup\$ – Phillip Jan 11 '13 at 2:26

The problem seemed to be that I was using the a Terrain as ground even though it was flat and the height was not modified. I'm using a blocking volume now and it works just fine.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.