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"

using Fmath for creating custom node

I have 2 very stupid qiestions. I need create custom node from this function - https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Math/FMath/ClosestPointOnTriangleToPoint/index.html I create custom C++ class in ue4, but I've never written code. Im working only with animations, and no have time for learn to code. 1. Who can write me a example of code for this function? (i need a simple math function in blueprint for compute closest point on triangle fron point in world space.) 2. Why so many function in Fmath library not include in blueprints? This library have a many very useful functions. But I can not reach them :(

Product Version: UE 4.14
Tags:
more ▼

asked Jan 18 '17 at 08:21 PM in C++ Programming

avatar image

maslenok
32 2 6 8

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

1 answer: sort voted first

Hi maslenok,

This actually isn't too difficult to do. In the header file for your new code class, you would need to add a new function declaration that matches the one in the function you are wanting to call in a public section of your class. You also need to make sure it is a UFUNCTION with the BlueprintPure (or BlueprintCallable, if you want it to have execution pins) specifier. So something like this:

 UFUNCTION(BlueprintPure, Category = TestCat)
 FVector GetClosestPointOnTriangle(const FVector& Point, const FVector& A, const FVector& B, const FVector& C);

Then your definition for your function would simply call the function you want to call and return whatever that function returns. Something like this:

 FVector AMyActor::GetClosestPointOnTriangle(const FVector& Point, const FVector& A, const FVector& B, const FVector& C)
 {
     return FMath::ClosestPointOnTriangleToPoint(Point, A, B, C);
 }

That will result in the following node for your Blueprint:

Node

Keep in mind that this node will only be available in Blueprints that are derived from your code class.

Tim

node.png (13.7 kB)
more ▼

answered Jan 18 '17 at 10:12 PM

avatar image maslenok Jan 19 '17 at 02:59 PM

Wow, thanks so much! I hope I was able to create a lot of other functions without going into programming :)

(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