playMaker

Author Topic: smoother smooth look  (Read 3594 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
smoother smooth look
« on: September 19, 2012, 10:22:17 AM »
So I've started making a very simple 1rst person shooter. Now, since I'm a perfectionist I actually manage to stumble upon problems even on a simple game as that :D

Here's the current controller:
http://twisted-pantheon.com/Downloads/shooter%20web/WebPlayer/WebPlayer.html

now you see that the white circle moves towards the center of the screen. It represents the direction the weapon is facing. Now, if you turn around fast, it  works fine, but as soon as you turn very slowly, it starts to get jaggedly. The reason is the "smooth look to" script which rotates the weapon. If it rotates by small degrees, because the weapon is almost on target, and then the target shifts, it has to suddenly move very fast again. That looks jittery .
Does anyone have any ideas how to make this look smooth? You can have the files if you pm me, I just won't share them freely yet, because it's gonna become a portfolio piece I think :)
Either way the smooth look at is really all there is to it. If anyone could make it so it'll ease in, that would be great. I'm in over my head with this :S

,kiriri

EDIT: my research nailed the problem down to updating position. if the gun is fixed in place, it won't jump ever . So each time you move the gun it'll change it's position and hence its rotation towards the target. That extra rotation is the jumpy movement. Me needs fix :D

PS:
Incase you might know a way to fix this, but don't have the time to do it right now, please post it here... I do know how to code, I'm just not having the spark here :D
« Last Edit: September 19, 2012, 11:28:54 AM by kiriri »
Best,
Sven

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: smoother smooth look
« Reply #1 on: September 20, 2012, 01:57:25 AM »
Hi,

 have you tried late update or fixed update?

bye,

 Jean

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: smoother smooth look
« Reply #2 on: September 20, 2012, 12:55:32 PM »
that was one of the first things I tried. Not working :S

thanks for the suggestion though :)

EDIT:
I fixed myself a solution to my problem, but unfortunately it won't replace the action. The smooth look moves jaggedly because the camera movement and the gun rotation overlap sometimes...

So what I did, is:
1) I duplicated the gun and moved it very far away
2) I put the original gun in a layer which is rendered by everything but the player's camera. This means everyone will see that gun, and since they won't see it up close, they won't mind the jagging.
3) I created a new camera and move it so it renders the gun duplicate from exactly the same angle as the original camera does the original gun.
4) I use an FSM which gets per frame the rotation of both the gun and the player's camera, then subtracts the gun rotation from the camera rotation and applies that to the gun duplicate. That way the gun duplicate renders exactly the same as the real gun, even though the new camera doesn't move at all.
And since the gun is the only moving thing, it translates smoothly.

Long story short: It's quite an ugly hack and there just has to be a better way than this :D
« Last Edit: September 20, 2012, 01:47:09 PM by kiriri »
Best,
Sven