Is it safe to compare transforms in c++?

like

actor.transform == actor.transform ?

or should i:

if (first_transform.GetLocation() == second_transform.GetLocation()
	&& first_transform.GetRotation() == second_transform.GetRotation()
	&& first_transform.GetScale3D() == second_transform.GetScale3D())
	return true;

or something else?..

I know in blueprint it has this “error tolerance” that was added not too long ago. what is what right way to do it in c++ ?

FTransform has a function called “Equals” which lets you pass in a tolerance as well. I think this will suit your needs.

e.g.

return first_transform.Equals(second_transform, 0.000001f));
1 Like

actor.transform == actor.transform should not compile anyway, as there is no defined operator==

Thanks ! :slight_smile: