Changing character movement speed causes camera rotation to speedup
lazeravik opened this issue · comments
Avik Biswas commented
I have a Blueprint character that inherits from c++. Nothing fancy in the c++ side just a base class
In the character bp i have a Python actor component attached .
Here is the python module
import unreal_engine as ue
class Player:
def begin_play(self):
# get a reference to the owing pawn (a character)
self.owner = self.uobject.get_owner()
# the following two values were originally implemented as blueprint variable
self.base_turn_rate = 70.0
self.base_look_up_rate = 70.0
self.owner.bind_axis('Turn', self.turn)
self.owner.bind_axis('LookUp', self.look_up)
self.owner.bind_axis('MoveForward', self.move_forward)
self.owner.bind_axis('MoveRight', self.move_right)
# bind jump actions
self.owner.bind_action('Jump', ue.IE_PRESSED, self.owner.jump)
self.owner.bind_action('Jump', ue.IE_RELEASED, self.owner.stop_jumping)
# bind sprint actions
self.owner.bind_action('Sprint', ue.IE_PRESSED, self.sprint_pressed)
self.owner.bind_action('Sprint', ue.IE_RELEASED, self.sprint_released)
def tick(self, delta_time):
pass
def turn(self, axis_value):
turn_rate = axis_value * self.base_turn_rate * self.owner.get_world_delta_seconds()
self.owner.add_controller_yaw_input(turn_rate)
def look_up(self, axis_value):
look_up_rate = axis_value * self.base_look_up_rate * self.owner.get_world_delta_seconds()
self.owner.add_controller_pitch_input(look_up_rate)
def move_forward(self, axis_value):
rot = self.owner.get_control_rotation()
fwd = ue.get_forward_vector(0, 0, rot[2])
self.owner.add_movement_input(fwd, axis_value)
def move_right(self, axis_value):
rot = self.owner.get_control_rotation()
right = ue.get_right_vector(0, 0, rot[2])
self.owner.add_movement_input(right, axis_value)
def sprint_pressed(self):
self.owner.CharacterMovement.MaxWalkSpeed = 2000.0
def sprint_released(self):
self.owner.CharacterMovement.MaxWalkSpeed = 600.0
I have shift
key assigned as Sprint binding
and when i press shift character movement increases and returns to normal when not pressed.
It works fine in the packaged build but in standalone or PIE when i press shift the camera rotation seems to get faster each time i press shift.
I am on WIndows 10 1909
UE 4.23.1