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"

Spawn emitter at socket location

I'm a c++ noob, so please go easy on me.

I set up a sprint system for my third person game. I created a particle system (called Sprint_Particles) to use as jet tails behind his feet, but I'm not sure how to add it. I'd like to spawn an emitter at each foot (I've created sockets called RightFootSocket and LeftFootSocket).

I've been looking at SpawnEmitterAttached but I can't quite figure out how to set it to use the player mesh or set it to use my particle system.

Thanks.

Product Version: Not Selected
Tags:
more ▼

asked Nov 26 '14 at 04:19 AM in C++ Programming

avatar image

micahpharoh
10 3 4 8

avatar image micahpharoh Nov 26 '14 at 09:35 PM

Any ideas on this one?

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

1 answer: sort voted first

Hi,

At first, create a variable in your Pawn class, e.g.

 UPROPERTY()
 TSubobjectPtr<UParticleSystemComponent> MyParticle;

Then, initialize it in your Pawn's constructor:

 MyParticle = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("MyParticleName"));
 
 //Attach PSC to socket
 MyParticle->AttachTo(RootComponent, TEXT("MySocketName"));
 
 //Reference to particle system asset
 static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleSystem
     (TEXT("ParticleSystem'/Game/Environment/Particles/My_particle_asset_name'"));
     
 //Set Particle system's template
 MyParticle->SetTemplate(ParticleSystem.Object);
 MyParticle->bAutoDestroy = false;

To get a reference to a particle system find it in content browser, and then Ctrl+C and Ctrl+V it into Visual Studio. Then, you can activate and deactivate particle system depending on your needs.

However, it is usually better to have assets references set up via blueprints, since hardcoding assets isn't very flexible.

Best,

Artem

more ▼

answered Nov 27 '14 at 03:36 PM

avatar image

Artem Gergel'
250 19 3 20

avatar image micahpharoh Dec 01 '14 at 01:00 AM

Works perfectly. Thank you!

avatar image micahpharoh Dec 01 '14 at 01:35 AM

Actually, I do have one issue. The emitter seems to spawn at his pelvis, not at the socket. It also doesn't seem to move relative to his foot. Have I got my sockets set up wrong?

(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