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 can I find the location of a socket through c++?

Is there a way to know the location of a socket on my character through the help of c++.

Suppose I have a socket on my characters hand. And I want to spawn a effect in the position of that socket, is there a way to do so?

Product Version: Not Selected
more ▼

asked Apr 27 '14 at 01:44 PM in C++ Programming

avatar image

428 77 118 148

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

1 answer: sort voted first

You can get the location with GetSocketLocation() https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/Components/USceneComponent/GetSocketLocation/index.html

You can also attach the ParticleSystem at the socket by simply providing the name of the socket in the AttachTo() method. https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/Components/USceneComponent/AttachTo/index.html

more ▼

answered Apr 27 '14 at 03:43 PM

avatar image

1.2k 27 22 211

avatar image envenger Apr 28 '14 at 10:44 AM

How do I use it?

Something like this?

 SocketLocation = USceneComponent::GetSocketLocation("FirePoint");

FirePoint is the name of the socket

avatar image Dieselhead Apr 28 '14 at 11:00 AM
 FVector socketLocation = Mesh->GetSocketLocation("FirePoint");

Where Mesh is your USkeletalMesh / USkeletalMeshComponent.

avatar image envenger Apr 28 '14 at 11:14 AM

Ok worked. Thanks..

Are all USceneComponents are used in this way?

avatar image Dieselhead Apr 28 '14 at 11:37 AM

How do you mean?

avatar image envenger Apr 28 '14 at 12:25 PM

Like other function using USceneComponents need to use its mesh as an pointer.

Means if I am using USceneComponent::AttachTo() to attach a particle emitter, I should write it like

 Particle->Attachto(Mesh, "FirePoint", KeepRelativeOffset);

Something like this?

avatar image Dieselhead Apr 28 '14 at 12:47 PM

Yes, but Mesh in this case is defined in the ACharacter class and is a USkeletalMesh. You can see it here in the list of variables: https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/GameFramework/ACharacter/index.html

The name Mesh would be replaced with the name of the variable holding whatever component you wish to attach the Particle to (in your example).

Also there's a difference between USkeletalMesh and USkeletalMeshComponent. USkeletalMesh derives from UObject which means it's not a USceneComponent.

avatar image AnxGotta May 09 '14 at 09:37 PM

There is also this option.

Link to other similar question

avatar image Snipe3000 Aug 07 '14 at 08:25 PM

Is this only for particle systems or could this work for projectiles as well?

(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