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"

Movement based on camera posistion (Resident Evil style)

Hi! I'm currently working on a prototype for a fixed camera style game like Resident Evil. I currently have tank controls hooked up to the d-pad (always forward, backward turn left and right)

Now I want to bind movement based on the camera location to the left stick. so no matter which way the camera is facing the character will always move to the left of the screen if the player is pushing left on the stick and so on.

I have a variable for the current camera and from that can get actor position but i'm kind of stumped on where to go next.

What's the best method for replicating that behavior?

Product Version: UE 4.17
Tags:
more ▼

asked Nov 20 '17 at 12:25 PM in Blueprint Scripting

avatar image

googleback
17 3 4 10

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

1 answer: sort voted first

You need to get camera vectors and use them as world direction for AddMovementInput actions I guess...

more ▼

answered Nov 20 '17 at 12:34 PM

avatar image

redbox
4.3k 81 17 104

avatar image googleback Nov 20 '17 at 01:15 PM

Kind of like this? Rotation and vectors really aren't my strong suit i'm afraid, thanks for the reply. I'm starting to see what I have to do but I suppose I'm just struggling to figure out to spell it out in the BP alt text

camerarelative.png (105.5 kB)
avatar image redbox Nov 20 '17 at 01:59 PM

There are few functiins to get actor forward and right vectors, or get them from actor rotation. just drag actor reference or rotator output and search for 'get vector'.

avatar image googleback Nov 20 '17 at 02:05 PM

Figured out the movement, thanks for pointing me in the right direction. Stick moves you relative to camera position, now I only have to make it so the camera change doesn't affect your direction until you stop moving :D alt text

Only problem is that I had to disable use control rotation yaw to get the player rotating properly. this means I can no longer turn on the spot with the d-pad bt at least I can while moving for now.

(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