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"

Decal alignment problem

Hi, I want to by using blueprints align my decal when placing them based off of the hit surface impact normal.

alt text

In this pic you can see that I have it working good while hitting the floor. The decal should be in the same direction as the white arrow

When I start shooting up a wall this happens:

alt text

I'm having trouble compensating the decal orientation and would be happy for any help on it :)

I do want to do this with BPs and here is my current nodework in its simpliest form:

alt text

the rotation from XVector only seems to work from the floor angles only. Again thanks for any suggestions =)

Product Version: Not Selected
Tags:
floor1.jpg (431.6 kB)
wall.jpg (307.3 kB)
bp.jpg (228.5 kB)
more ▼

asked Dec 07 '14 at 02:28 AM in Blueprint Scripting

avatar image

Devero
2.3k 114 61 233

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

3 answers: sort voted first

Thanks again for the suggestion. I was not able to get that idea to work out. However, I did work on more equations and came up with a solution that works great.

alt text

And for anyone interested in my Blueprint

alt text

Thanks for all your suggestions!

testgood.jpg (940.3 kB)
finalalign.jpg (559.1 kB)
more ▼

answered Dec 10 '14 at 06:54 AM

avatar image

Devero
2.3k 114 61 233

avatar image Eelis Otsamo Dec 09 '16 at 09:51 PM

Hey, could you tell me how you calculated the white arrow direction?

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

Hey Devero - just so I understand your blueprint code correctly, it looks like you are determining a vector in which to align the decal. Given that decals project onto surfaces through their -ve X axis, I would suggest the best way to achieve the result you're after is to find the surface normal of the point you want to align to, and get rotate onto that instead (to ensure that your decal is projected onto the surface correctly).

You should then be able to calculate a rotator for the local-space yaw that rotates the decal's YZ plane into the correct direction.

I hope that makes sense? I'm happy to elaborate if needed - check out the surface snapping feature in the editor to see how we do this for placement of actors (which includes decals)

more ▼

answered Dec 08 '14 at 04:31 PM

avatar image

BrɑκеPɑd STAFF
1.4k 33 22 78

avatar image Devero Dec 08 '14 at 08:14 PM

Thanks Andrew for the suggestion. Here is the pic of the changed decal projection, Blueprint. I actually tried this first but was unable figure out the Roll value.

alt text

So now the decal is projected perfectly onto any surface normal. However, Now I need to rotate the decal to match the direction of my white Arrow by inputting the "Roll" value to the decal. I'm still having issues figuring out the blueprint way to do it.

alt text

I appreciate any further help you can provide on this! Thanks!

alignmenthelp.jpg (443.1 kB)
align2.jpg (421.7 kB)
avatar image BrɑκеPɑd STAFF Dec 09 '14 at 09:55 AM

Hey - I had a shot at this myself - basically if you use the fact that the magnitude of the cross product of two vectors equals the sine of the angle between them { |a x b| = sin(theta) }, you should be able to transform your local-space direction vector into world space, cross this with some world space target vector and get the roll angle from that.

Here's the Blueprint I came up with for this, hopefully it will put you on the right path:

alt text

avatar image Devero Dec 09 '14 at 05:24 PM

Thanks for the continued help. I implemented your nodes and it gets just about there. The problem is when you take the arcsine the resultant only accounts for 0-90 degrees. Everything works great if I shoot ingame for only the 0-90 quadrant.

Works partly

Here is the updated blueprint node

alt text

Again I appreciate your help and patience as its so close from working!

ingame.jpg (243.7 kB)
quads.jpg (573.8 kB)
avatar image BrɑκеPɑd STAFF Dec 09 '14 at 10:50 PM

Maybe you could try composing a rotator from the angle axis of the cross product? The cross product will flip when it traverses a 180 degree boundary, so it should rotate correctly (provided your two vectors are on the same plane)

alt text

angle-axis.png (54.2 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Apr 24 '17 at 11:57 AM

avatar image

Sn_a_ke
142 9 16 20

avatar image Van Der Wolf Aug 21 '17 at 06:52 PM

Thanks a lot! I used it to spawn my foot decal on landscape slopes and it works perfectly...even on very steep ones

(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