Hi Everyone
I love the Unreal Engine; some things I have a natural affinity for but Ive run into a snag in blueprint scripting. Im using the Y mouse axis to control the rotation, works great, no problem, infinitely. However I do not want the object to spin infinitely; Id rather see the object rotation stop at +45degrees or -45degrees from initial rotation no matter how far I move the mouse. Ive tried using tutorials and tips from other posts but nothing has worked yet.
Basically, move the mouse up, the object should spin upward but stop at +45 degrees from initial rotation. Move the mouse down, object spins downward but no more than 45 degrees from initial rotation. The maximum rotation would be a total of 90 degrees maximum from the +45 extreme top, and -45degrees to the extreme bottom.
The object will never face the camera; at least not yet. See screenshot.
The object still spins infinitely according to mouse Y axis value. Some clarification needed is when the object rotation nears either +/- 45degrees it should stop rotation although the mouse is continuing its movement. I do see what you are doing with the >= Booleans. Makes sense but still is not limiting/locking the rotation at a specified angle.
Im going to take another look at the blueprint and the meshes. This might be the answer. Some tweaking will be needed but this looks to be a step in the correct direction. The angle of the rotating object should be compared to a static angle to determine minimum and maximum angle values?
The logic is this: If Arms (Get Rotation) less than 45 and axis value greater than 0, or if Arms (Get Rotation) greater than -45 and axis value less than 0, then add rotation
Everyone has been on track with this one. This one looks correct. I might use >= and <= for the GetWorldRotation output; I’m “thinking” that if it is at 0, 45, -45, rotation may be disabled. I’ll plug it in and respond this afternoon!
Progress has been made. It is stopping rotation but not at the desired angle. Also, the rotating object is gradually rotated into a ‘dead zone’ where no rotation occurs in either direction. Also, it is the pitch that is being controlled, but the angle that is to be measured for condition is Roll (X), not Pitch(Y). I only discovered this using the Print String function. More tweaking is needed; it is definitely stopping now.