Hello everyone, I'm new to unreal and this will probably be a noob question... While my character is in a certain room I want it's projectile velocity to change

I thought I could use a box trigger to activate this event by casting it to projectilemovement component and setting it to something lower. Not sure if this would work, but right now it doesn’t because I don’t know what to put in the object input of the cast function.

Thank you for the reply. I understand what you’re doing, but it doesn’t work for me. I’m using the first person shooter template and the projectile’s speed is determined in the blueprint of the firstpersonprojectile itself under projectile. My character only spawns one of these projectiles in a certain spot, but doesn’t do anything else. So I can’t cast to my character and then set the speed value of the projectile as it isn’t in the part of the character. What I can do, is create a new projectile and change the projectile my character fires. However, I think creating a blueprint just for a room is a bit redundant. Do you think you can still help me?

yea that makes way more sense that your trying to modify the projectiles speed. its not too difficult to achieve either just need to make a few variables and set a few values.

to start go into the projectile blueprint and create a variable, name it something like initial speed. then with the variable you created go to the details panel and check “expose on spawn”, you may also need to make the variable public by clicking the little eye next to it in the my blueprint section. by checking expose on spawn a new pin will show up on the spawn actor node as we will see in the next section. ok now to finish things out in this blueprint go to the construction script, drag projectile (your projectile movement) into the graph then drag off the node created and search for set initial speed. lastly connect your variable to the set node as seen in the first picture below.

ok for the next section open your first person character. move over to the spawn actor from class node and you will see that it has a new pin that has the same name as the variable you created in the projectile bp (you may need to compile and or save for the pin to show up). now create a new variable in character and call it something like projectile speed, at this time you will also want to set its default value to about 3000 which is the default for the first person projectile. then just connect this new variable to the initial speed pin on the spawn node as seen in the below picture. this section basically sets the initial speed of the projectile as its spawning.

the last step is to actually set the projectile speed when entering the trigger box. to accomplish this pretty much the same as i described in the last post, by creating a trigger in the level then gettting a on begin overlap event for the trigger box casting to the class of your player character. after the cast drag off the as first person character pin and search for the projectile speed variable and click the set version. from here set it up as seen in the below picture and duplicate it for the end overlap event with a different speed value being set.

i had to separate this into two comments due to the character restriction on replies. so just imagine this paragraph came just after the text in the last post. also im going to try to modify this a little later so its just a speed modifier instead of actually setting a set value, but the method described above works.

Wow, thanks for taking the time to explain this. I’ll try it once I get home. I hope it’ll work.

Alright, thanks a lot! It finally works! This problem has been resolved.

Please select one of the comments and convert it into an answer so you can mark it as correct, or add a dummy answer so that people browsing for questions to answer will not think this still needs an answer.

characters dont usually use projectile movement but anyhow you wont be casting to the projectile movement you need to cast to the actor that the projectile movement is part of. so in this case you will cast to your characters class then get the projectile movement. as for the object pin this needs to be a reference, in your case a reference to your character.

below is the basic setup of when the character overlaps the trigger volume it casts to the class of the character, then gets the projectile movement component, then sets a value within it. to summarize the reference gets an actor, the cast compares the actor to a class to define and identify what the actor is, then you can modify the values it contains.

but i dont wanna haha yea fixed it up now was just waiting to make sure it worked.