• News

• Industries

• Learning & Support

• Community

• Marketplace

# Why are the vectors of get actor location and get actor bounds (origin) not the same?

Hi.
I obviously don’t quite understand how GetActorBounds works. I have a blueprint called BP_Wall and inside there is a static mesh of a wall. In the blueprint itself the coords of the mesh/wall are 0,0,0 for x, y, z and the scale is 1.

I drag that wall onto the level and scale it to 2.5 for x, y and z.

its location is 300, -120, 80.

when I get actor location I get back 300, 120, 80.

but when I get actor bounds (origin) I get a different vector.

not sure why the origin isn’t the same as the location

thanks.

Based on my limited understanding, getactorbounds return the bounds of all that are within the blueprint. Which include any particle system bound even if it is not physical in nature. You could do a debug box or line to see it visually on the bound constraint. Origin from getactorbounds should return fbox origin.

So after some reading I found another post Get Extents of a Static Mesh - Unreal Engine Forums

What I am trying to do is use the local bounds to spawn another actor in a random position anywhere in front of a wall - so the only requirement is the actor is spawned in front of the wall but doesn’t matter exactly where. So I’m getting the local bounds of the wall and scaling it appropriately and using that transform for spawning but the local bounds seems to be vector points relative to 0, 0, 0 of the world so that at spawning the object is not located in front of the wall it’s spawning around the 0, 0, 0 point of the world. Am I correct in assuming that is what is happening?

Also the “wall” that i’m using is a static mesh component in a blueprint called BP_Wall and when I drag it onto the level the pivot point for the wall isn’t in the centre - but as i understand it that shouldn’t be an issue for Get Local Bounds because it will just work out the vectors either side of the pivot point wherever that happens to be. Is that also true?

And if anyone has any great ideas on how to spawn an actor in front of a wall (i think i’m on the right track) - that would be great.

Thanks

it is hard to visualize what went wrong for your code without a posted bp. GetLocalBounds should only return relative position, not world position (if the function exist. i have not used it before). How about line trace to the object and offset it slightly in front of it.