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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to limit a camera's location in 1 axis

Hello there! I'm making a Mario clone for a class in university using UE4 but I'm having trouble with the camera. Basically, I want it to update its transform so it doesn't move backwards with the player (kind of like constantly clamping the y axis location). As of now, I have that, but the camera snaps back to the player when he starts moving forward again. Also, how could I go about saving the current position of the camera so that it starts following the player when he reaches that location.

Thank you for your time! And sorry if I'm unclear.

alt text

Product Version: UE 4.9
Tags:
more ▼

asked Nov 12 '15 at 03:26 PM in Blueprint Scripting

avatar image

OrangeDishes
11 2 4 4

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

2 answers: sort voted first

All right, found it! By attaching the camera to the player character and comparing the latter's world position with the camera's, I could achieve what I was looking for. alt text

more ▼

answered Nov 13 '15 at 01:39 AM

avatar image

OrangeDishes
11 2 4 4

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

I wrote you this function to get the targets (Marios) relative screen position. Only works for left and right whereas the function returns 0 if the target is in the middle of the screen, 1 at the right and -1 at the left.

alt text

unbenannt5.png (596.7 kB)
more ▼

answered Nov 13 '15 at 10:13 AM

avatar image

JulianS
183 4 9 18

(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