Download

How can I reset my player rotation correctly ?

Hi there,

Here is my problem : I’m trying to build a cover system from the TwinStick Shooter tutorial epic provide. The fact is that my character is rotating when he’s getting in cover, but it can’t reset to the normal rotation, even if I sore a variable with the default rotation at the moment the game is playing.

The process to do that : I’m launching a trace, that return me the cover the character will use. Then, I get the rotation of this cover, and make a Lerp(rotator) to have a smooth transition between the default rotation and the cover’s rotation, so that the character has the same rotation. And finally, when I’m leaving the cover, I’m trying to reset the character rotation to the “Default” one. But… its not working at all.

Here are some screenshots of the game and the Blueprint I’m using to do this :

Capture.JPG

a9a565f298d32f70fba5ba7cc54b2f69e20bc229.jpeg

2dcc6ff07b44a8725ded10c5fbf193d1a09f144c.jpeg

559368e9f852d632c719280ec61401904cf5d906.jpeg

710f5c05553c6feff7ce3ea19ad3454a2b5a02c8.jpeg

924c09e4c2c845504da074a135d4d7fcba0d617a.jpeg

ad49dba859c3aa7ca622673a0959bedffa50df03.jpeg

ebff7455a41321fc31d1816254d97b100d0cb034.jpeg

Sorry for the long post …
Thx,

Dusaral

If you use AI for driving your pawn you should try: “Set Focus”, “Clear Focus”, “Get Focal Point”.
I decided to add pawn AI (and give it direct basic orders) as middle man for controlling pawn, all problems of transitioning between anims, adding idle etc are already solved by Epic. Driving player pawn trough AI is so much less messy.

Well I think I’ve found another solution.
The problem seems to come from the fact that I was storing my Default Rotation variable from the event begin play … Which wasn’t really stored !
Since the moment I moved the setting of this variable to an input fired, it worked …

Anyway, Thx Nawrot :wink: