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"

walk to swim transition question

Hi guys,

I have a beach in my scenery where the character can enter to swim in the ocean. The water is very shallow for the first couple of meters where I want my character to walk calling the walk animations from the Anim_BP. At a defined water depth I want my character to switch to swim animations in the Anim_BP. I got the walk to swim animations working, that is not the problem. I need to find a way that my character can determine the depth of water he is standing in to decide when to transition into "IsSwimming" How can I do this?

Currently my character starts swimming as soon as "Is Swimming" is triggered when actor is overlapping with the physics volume, so basically directly when touching the water. It looks strange when doing a breast stroke in 10cm of water depth.

any suggestions much appreciated!

Product Version: UE 4.21
Tags:
more ▼

asked Dec 16 '18 at 09:54 AM in Blueprint Scripting

avatar image

Pilleman22
1

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

1 answer: sort voted first

After checking "Is Swimming", add a branch to check the relative Z position of your character and the physics volume.

You can do this by getting the bounds of the volume and adding the Z bound component to the volume's origin Z to get the Z position of the water's surface (top face). Then check your character's Z location and compare it to the water surface Z position and make your assessment from there.

e.g. Branch true if (WaterSurfaceZ - PlayerZ) > 50, false otherwise.

This will ensure the character's center point is at least 50 units submerged before triggering swimming logic.

Hope that helps!

more ▼

answered Dec 16 '18 at 11:25 AM

avatar image

ThomasUrwin
6 1 3

(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