Announcement

Collapse
No announcement yet.

Getting the Height in Blueprints

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Getting the Height in Blueprints

    Is there an action to get the height/weight/length of a static mesh and how would this be implemented in a blueprint. For example, I have a cube called "Cube1" that is 400 in height. In a blueprint I need to reference the cubes height, but I do not just want to just type it in in case I change the height of the cube later on.

    I cant seem to find it in anywhere on the forums, i
    s this a thing?

    #2
    I don't know why but Unreal seems to make a real hash of this. I think maybe that when they created the engine they were just playing games and thought that real world dimensions of your mesh were simply not important. Collisions were everything. Anyway, moan over.
    If you have your Static mesh as an actor then you can use GetActorBounds - which returns an origin and a Box Extent. So, the Box Extent vector will give you half your actual height, width and length. I have not tried this on very complex shapes and, it does seem to make some odd decisions if you rotate the actor in your scene before getting the bounds. But, maybe you can make it work for you. Use 'Draw Debug Box' to see what you are getting.
    There is also GetComponentBounds and GetLocalBounds but they are a bit of a mystery to me at the moment about where they get their numbers from.
    Unreal does some very difficult sums very well and then this.....

    Comment

    Working...
    X