Sometimes in my mod I want my pawn's rotation to not be affected by the player's view (this is a 3rd person mod), and other times I want it to be. This is proving to be alot more difficult than it should be.
The only way I can change rotation is by either direct calls to SetRotation or calling Controller.SetViewRotation. I can't get DesiredRotation to work at all.
Changing the Yaw to be += 16384 (90 degrees) with Controller.SetViewRotation() rotates the view and the pawn, as I would expect. But changing the Roll just resets the view to the default, and changing the pitch always makes the camera go right under the pawn looking straight up at his crotch (even with LimitPitch overridden).
Why don't xPawns seem to respond to DesiredRotation? The description in Actor.uc says that the physics will automatically rotate the actor to DesiredRotation, but this doesn't happen. At first I thought this was because I wasn't rotating the controller, but setting the controller DesiredRotation to the same value at the same time still does not work. bRotateToDesired is true for both pawn and controller. Setting bSetTurnRot for the controller to true doesn't work either.
Another theory -- since it seems DesiredRotation is applied in native physics code, I thought maybe pawn's were specially exempted. But if you look in xPawn.uc there's a function called RandSpin() defined that uses DesiredRotation -- although calling it does nothing. It's also not called in any of xPawn's subclasses. I thought maybe it would be called in native code for ragdolls -- but why do that when all the other ragdoll stuff is in script?
More checking -- no states defined in pawn.uc, xpawn.uc, controller.uc, playercontroller.uc, or xplayer.uc ignore DesiredRotation.
At this point it looks like the only way to get my own smooth rotation is by calling SetRotation by the tick -- which would be a pain, and would have to take into account stuff like one desired rotation one tick and a different one the next tick
Any ideas on how to get DesiredRotation to work for pawns? Or a simpler way to get smooth rotation?
P.S. I'm testing all of this by using an exec function and binding a key to it. And yes I've used logs to make sure it's running =)
The only way I can change rotation is by either direct calls to SetRotation or calling Controller.SetViewRotation. I can't get DesiredRotation to work at all.
Changing the Yaw to be += 16384 (90 degrees) with Controller.SetViewRotation() rotates the view and the pawn, as I would expect. But changing the Roll just resets the view to the default, and changing the pitch always makes the camera go right under the pawn looking straight up at his crotch (even with LimitPitch overridden).
Why don't xPawns seem to respond to DesiredRotation? The description in Actor.uc says that the physics will automatically rotate the actor to DesiredRotation, but this doesn't happen. At first I thought this was because I wasn't rotating the controller, but setting the controller DesiredRotation to the same value at the same time still does not work. bRotateToDesired is true for both pawn and controller. Setting bSetTurnRot for the controller to true doesn't work either.
Another theory -- since it seems DesiredRotation is applied in native physics code, I thought maybe pawn's were specially exempted. But if you look in xPawn.uc there's a function called RandSpin() defined that uses DesiredRotation -- although calling it does nothing. It's also not called in any of xPawn's subclasses. I thought maybe it would be called in native code for ragdolls -- but why do that when all the other ragdoll stuff is in script?
More checking -- no states defined in pawn.uc, xpawn.uc, controller.uc, playercontroller.uc, or xplayer.uc ignore DesiredRotation.
At this point it looks like the only way to get my own smooth rotation is by calling SetRotation by the tick -- which would be a pain, and would have to take into account stuff like one desired rotation one tick and a different one the next tick
Any ideas on how to get DesiredRotation to work for pawns? Or a simpler way to get smooth rotation?
P.S. I'm testing all of this by using an exec function and binding a key to it. And yes I've used logs to make sure it's running =)
Last edited: