x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text

Any help?

Product Version: UE 4.16
Tags:
movingobjects.png (340.7 kB)
more ▼

asked Jul 04 '17 at 08:14 AM in Blueprint Scripting

avatar image

ZeroMaintenance
1 1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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 ;)

more ▼

answered Jul 04 '17 at 08:52 AM

avatar image

AmphDev
1.5k 15 9 34

avatar image ZeroMaintenance Jul 04 '17 at 11:56 AM

How do i connect blueprints and c++ im not good at c++. Also thanks for recommending me axis binds :D

avatar image AmphDev Jul 04 '17 at 01:56 PM

Why do you want to connect c++ and bp? Everything can be done in blueprint what i told you before ;)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

So im home, this is how need look in BP

https://blueprintue.com/blueprint/ij0c65bj/

more ▼

answered Jul 04 '17 at 03:26 PM

avatar image

AmphDev
1.5k 15 9 34

avatar image ZeroMaintenance Jul 05 '17 at 06:53 AM

Nope its still not working. I copy-pasted blueprints i set event but camera is not moving still :|

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question