Download

Equal or nearly equal rotator problem

What i am trying to do here is to get a relative rotation of an actor (the root component is getter from actor cast ) on Y axis.This actor is rotated by physics handle from my player character with get mouse position. And i want if the rotation of this actor is 90 ±1 on Y axis to fire some event on branch true.And for that reason i put 1.000000 tolerance, so if its 90 or 91 it still be considered as true( if i’am not wrong how these tolerance values are added to rotation values)

The problem is if the actor rotation is 90 or 91 on Y axis its still considering it as false.Also i tried to split struct pins and connect only Y axis, still always fire false.

I also tried with nearly equal transform and nearly equal float with and without split struct pin. I tried many different ways and i’m kinda stuck here.

Can anyone help ?

Regards!

That’s not what you’re doing here though, you’re comparing XYZ rotation to 0/90/0. So if you’ve got 2/90/0 for example it won’t be true. Instead you could split/break the rotators, and get the XZ values from Get Relative Rot and put them in the Rotator==Rotator (again splitting it).

Thanks for the reply,

I’ve already find a way to make it work. First i store the rotation with rotator variable in the desired object. Then instead of getting root component from casting actor i get this rotator variable. Then nearly equal transform and for A pin make transform and then for rotation i plug this getter variable from the casted actor.Then i find desired rotation tolerance which is +5,-5 degree which is equal to 0.044444. And its work perfect.

Have a nice day!

There’s an FRotator Equals Blueprint function that takes a tolerance value.
https://docs.unrealengine.com/en-US/…tor/index.html [TABLE=“cellspacing: 0”]

bool

		[Equals](https://docs.unrealengine.com/en-US/API/Runtime/Core/Math/FRotator/Equals/index.html)


		(
		    const [FRotator](https://docs.unrealengine.com/en-US/API/Runtime/Core/Math/FRotator/index.html) & R,
		    float Tolerance
		)
		Checks whether two rotators are equal within specified tolerance, when treated as an orientation.