How to move objects without knowing where will moving end?
Hello. I need to know how to move object (camera in this case) but i dont know where will object finish moving. If you dont understand: While left arrow on keyboard is down camera will move left, while right arrow is down camera will move right. I cant know how long user will keep arrow key down. I need to replace SetActorRelativeLocation with something else. Theres blueprint script:
You need get location first, then add your desired movement vector to original location and set new location. Im from mobile so i cant post picture, but in theory for example upwards movement:
NewActorLocation = GetActorLocation + FVector(0,0,1)
This will add 0,0,1 xyz location to your original actor location in each tick, so basically actor will lifting up with 1cm every tick.
Ps. Im recommend do not use while cycle for key press as in your picture, because you will do infinite loop when key is down.. use axis binding for this! :) Axis binds are called/processed in every frame tick, and they can have a value which is 0 when not pressed and any other range of value what you setup in project settings.
That will help to move your camera because 0,0,1 movement vector can be your axis value ;)
Follow this question
Once you sign in you will be able to subscribe for any updates here