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"

Actor's location not updating with it's static mesh component

Hi Guys,

I have an issue with one of my actors where the location of the actor doesn't change in-game when the actor in question is moved, however it's StaticMesh component location does. As such, SetActorLocation doesn't have any effect. I should note that I'm working in the Level Blueprint, trying to reset the actor on the EndOverlapEvent of a Trigger Volume. I've included a picture for reference:

alt text

The default ball location is where I want the actor (BP_Football) to reset to after a goal, and it's the starting location of the actor in the level.

Below is a comparison of the position of the Actor vs the position of the Actor's StaticMesh component during play in-game.

alt text

I'm pretty new to this, so I'm not sure why I the two locations are different and if I can't get them updating together.

Any ideas or information would be much appreciated. Thanks!

Product Version: UE 4.16
Tags:
fognx7w.png (167.1 kB)
comp.png (322.7 kB)
more ▼

asked Jun 15 '17 at 09:55 AM in Blueprint Scripting

avatar image

DTGJoe
33 1 4 5

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

3 answers: sort voted first

Figured it out in the end: turns out I didn't have the Football blueprint's Static Mesh component set as the Root. The code now executes exactly as expected.

more ▼

answered Jun 19 '17 at 02:20 PM

avatar image

DTGJoe
33 1 4 5

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

You use Set relative location. But I think you should use SetActorLocation to make it in world coordinates.

more ▼

answered Jun 15 '17 at 10:08 AM

avatar image

redbox
2k 69 9 78

avatar image DTGJoe Jun 15 '17 at 10:17 AM

Thanks for the reply, I just swapped RelativeLocation and SetActorLocation out and it doesn't seem to make any difference unfortunately.

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

Your set location does not have a proper target. You must set the Football to be the target if you want to move the target. Drag out a pin from the football reference and use set actor location. Then give it the vector for that location as you have already done.

HTH

more ▼

answered Jun 15 '17 at 11:07 AM

avatar image

NoobsDeSroobs
2.5k 98 22 157

avatar image DTGJoe Jun 15 '17 at 11:44 AM

Hey, thanks for the reply. I've done as you instructed, however it hasn't worked - the location of the actor still doesn't change.

alt text

lvlblueprint.png (138.9 kB)
avatar image NoobsDeSroobs Jun 15 '17 at 11:51 AM

And you have confirmed that the code is being executed? Try setting it to teleport. Make sure you dont have the ball set to static or something. Finally, how are you moving the ball inside the blueprint?

avatar image DTGJoe Jun 15 '17 at 12:12 PM

I'm seeing the "GOAL" string getting printed out every time the ball passes through the trigger volume, so I'm pretty sure everything is executing.

Teleport didn't seem to do anything, but I did notice that my Default Scene Root in the ball actor wasn't set to Moveable, which it now is. This didn't do anything either unfortunately.

As for how I'm moving the ball; the blueprint for that actor itself is empty. I've got a Static Mesh which is simulating physics, as well as Generating Hit Events. I'm using the Collision Preset 'Physics Actor'. I also have a Sphere Collision component with more or less the same setup. Simulating Physics, Generating Hit Events, setup as a Physics Actor, etc. I'd be happy to provide screenshots if necessary.

avatar image NoobsDeSroobs Jun 15 '17 at 12:47 PM

Make sure the DefaultBallLocation is anot the same location it is.

avatar image DTGJoe Jun 15 '17 at 01:13 PM

I changed the x,y, and z values of vector DefaultBallLocation so as to make sure that it's not equal to the start location - again though, it doesn't appear to have done anything. Can you think of a reason why the ball's current location while in-play wouldn't match that of it's own Static Mesh?

avatar image redbox Jun 15 '17 at 02:01 PM

As NoobsDeSroobs said, make sure that code executed.

Is this checked in your ball actor?

alt text

avatar image DTGJoe Jun 15 '17 at 02:43 PM

Yeah, the Generate Overlap Events checkbox is ticked. Also, I'm seeing the print get executed so I'm pretty sure the rest of the code is executing - unless there's another way to check for certain?

avatar image NoobsDeSroobs Jun 15 '17 at 02:46 PM

You can see it fire if you look at it while it is running. Connect the M key event to your code, and, when you press it, see the lines light up on the other screen. If you dont have another screen, add a 2 sec delay, hit M then swap to the level blueprint tab.

avatar image DTGJoe Jun 15 '17 at 03:02 PM

Thanks for the reply. I'm able to see the lines between each function light up/activate when the ball exits the Trigger Volume.

(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