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 do I get the distance between an actor and the terrain?

I have a camera for RTS game and I want to keep the camera at a certain height above the terrain and also within certain world space limits. I need a way of obtaining the vertical distance between them. How can I achieve this?

Product Version: Not Selected
Tags:
more ▼

asked Apr 04 '14 at 07:36 PM in Blueprint Scripting

avatar image

x3rx3s
21 4 6 8

avatar image Shadowriver Apr 04 '14 at 08:06 PM
(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Managed to figure it out! I use a trace from the camera's vector down to a vector using same x and y, then set z to -1000 or whatever to get a vertical trace straight down, which returns the point at which they collide. From there, I calculate the difference.alt text

more ▼

answered Apr 04 '14 at 08:11 PM

avatar image

x3rx3s
21 4 6 8

(comments are locked)
10|2000 characters needed characters left

Well i just watched video i post you (which i seen it in past but i for got what exactly it was) and based on it you need to use tracing to detect ground :)

more ▼

answered Apr 04 '14 at 08:08 PM

avatar image

Shadowriver
35.2k 921 166 1098

avatar image x3rx3s Apr 04 '14 at 08:17 PM

thanks shadowriver. I managed to figure out a similar method - if not the same - as in this video and it works wonderfully. have posted my blueprint as answer for future reference.

(comments are locked)
10|2000 characters needed characters left
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