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"

C++ Particle System - Set initial velocity / rotation

I am trying to create an effect where when a player jumps I shoot particles out the bottom of the characters foot.

SETUP

Character.h

 UParticleSystemComponent* MultiJumpParticleSystem;

Character.cpp: (constructor)

 MultiJumpParticleSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("MultiJumpParticleSystem"));
     MultiJumpParticleSystem->bAutoActivate = true;
     MultiJumpParticleSystem->SetRelativeScale3D(FVector(0.2f, 0.2f, 0.2f));    
     //MultiJumpParticleSystem->SetWorldRotation(FRotator(0, 90, 90));
     MultiJumpParticleSystem->AttachTo(GetMesh(), FName("foot_r"), EAttachLocation::KeepRelativeOffset);
     
     static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleAsset(TEXT("/Game/Sample_sharedassets/Models/Thrust.Thrust"));
     if (ParticleAsset.Succeeded())
     {        
         MultiJumpParticleSystem->SetTemplate(ParticleAsset.Object);        
     }


PROBLEM

The particle system always shoots the particles down the Y axis. I would like for the particles to shoot straight down. When I blueprinted this out I was able to change this by going into Cascade and changing Start Velocity to go down the Z access. I cant figure out how to do this in code though.

Product Version: UE 4.10
Tags:
more ▼

asked Dec 22 '15 at 03:08 AM in C++ Programming

avatar image

Demonicated
336 33 36 206

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

2 answers: sort voted first

Have you tried setting your emitter to use local rotation? (available on the emitter section in Cascade).

Ideally you should be able to design you emitter exactly how you want in Cascade itself without having to set any additional rotation through C++ or elsewhere.

BTW have you considered using anim notifies on your jump animation? They sound ideal for your situation - check out this video from Epic.

Hope this helps.

more ▼

answered Dec 22 '15 at 06:11 AM

avatar image

VSZ
929 24 28 54

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

For anyone that needs pictures and instructions (version 4.10.x):

1) Double click you particle blueprint in the content browser. 2) Double click on the field that says Required (yellow) under the orange Particle emitter box 3) In the details panel there is an emitter rotator field you can modify.

alt text

capture.png (686.3 kB)
more ▼

answered Dec 22 '15 at 07:06 AM

avatar image

Demonicated
336 33 36 206

(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