How do I get the size of a static mesh?

Basically I have 2 static mesh actors, The first actor can be moved around the map and the second actor follows the first actor at an offset.

To get this offset I need to know the value of size of the first actors static mesh as it can be changed at run time and I don’t want the second actor to ever collide with the first.

So how do I go about getting the first actors static mesh size?

#Actor Bounds, Actor.h

/**
	 *	Returns the bounding box of all components that make up this Actor.
	 *	@param	bOnlyCollidingComponents	If TRUE, will only return the bounding box for components with collision enabled.
	 */
	UFUNCTION(BlueprintCallable, Category="Collision", meta=(FriendlyName = "GetActorBounds"))
	void GetActorBounds(bool bOnlyCollidingComponents, FVector& Origin, FVector& BoxExtent) const;

:slight_smile:

Rama

Once again thank you Rama!

Thank you so much for the answer. I tried to implement it but the result does not make any sense for me. Could you please lead me about the usage?

The mesh is the one in blue.

12818-scene.png

Your code is wrong, which is why you are getting bad values. You have:

“Ground Extends x: %d y: %d z: %d

What you should have is:

“Ground Extends x: %f y: %f z: %f