playMaker

Author Topic: [SOLVED] Quaternion Slerp overriding updated rotations?  (Read 1829 times)

14 Hertz

  • Playmaker Newbie
  • *
  • Posts: 2
[SOLVED] Quaternion Slerp overriding updated rotations?
« on: November 06, 2015, 02:36:25 AM »
Apologies for the slightly convoluted title, wasn't quite sure how to best express the issue correctly.

Basically, I have a rigidbody-based 3ps-style character controller which I am aligning to the terrain using the standard method of raycasting down and aligning smoothly to the normal. After much pain, I've managed to make it work how I needed, but the problem is this: The slerp I am using to smooth the alignment is "overriding" the rotations I'm applying to the character for mouse aiming - if I move the mouse left or right to turn the character horizontally (around the local y axis), it will turn slightly but then jerk back to the "forward" position.

I've tried countless ways to get round this: Played around with late updates, tried to compound the mouse-based rotation onto the main rotation, but so far I've had no luck whatsoever. The current setup I have is:



I normally prefer to try and work things out on my own but I've completely run out of ideas here. Anyone able to offer some insight? Thanks in advance.
« Last Edit: November 08, 2015, 10:24:58 AM by 14 Hertz »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Quaternion Slerp overriding updated rotations?
« Reply #1 on: November 06, 2015, 07:07:28 AM »
Hi,

 you need to control a dummy without smoothing, and then your have your character smoothing out itself against the dummy rotation.

then you can experiment where you can insert the terrain alignment.

 Have you tried this?

some other solutions is to map the mouse position to the plane of the player ( that is already aligned to the terrain) and then the mouse position target to smooth to is already in the right "plane".


 Bye,

 Jean

14 Hertz

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Quaternion Slerp overriding updated rotations?
« Reply #2 on: November 08, 2015, 10:24:23 AM »
I had considered the dummy option but I had it as a complete last resort because I was convinced I could do it in a more streamlined way. I ended up using the second method you suggested, which works perfectly, and also simultaneously seemed to clean up a separate problem I was having with the character spinning out of control at the "poles" of the rotation. Huge thanks for your input!