playMaker

Author Topic: 3rd person issue  (Read 7654 times)

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
3rd person issue
« on: November 27, 2013, 01:14:03 PM »
Hi!

I've setup a simple 3rd person character control(like the in in huttong games tutorial). I've attached the Main Camera to the character.
Works fine, except one thing: When I move backwards, the camera goes crazy, it starts to make small but fast rotations left to right - right to left.

Can anyone help me with this?

Thanks.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: 3rd person issue
« Reply #1 on: November 28, 2013, 03:23:19 PM »
Hi, I think this is were your issue lies.

"I've attached the Main Camera to the character".

If you re watch the tutorial the main camera looks at the character and is not attached to it.

one thing to watch out for is ensure the tool handles are in local and not global if you want to view the character rotating and facing in the z axis.

One thing I have noticed and am unsure why.

when I select a new direction the capsule rotates to face the new direction but there is a pause of maybe 1 second before I move in the new direction.

I do not notice this on the tutorial possibly someone with more experience could answer why.

edit: I had a cube attached with a box collider once I removed this everything worked.

Hopefully if you un parent the main camera from the character this will solve your issue.
« Last Edit: November 29, 2013, 05:04:13 AM by colpolstudios »

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: 3rd person issue
« Reply #2 on: November 29, 2013, 01:28:41 AM »
I don't want to detach the Camera, as it has to follow the player character. BTW,
I've seen this method of following the character with the camera by attaching it, in an other hutonggames tutorial.

Thanks anyway. Any other suggestions?

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: 3rd person issue
« Reply #3 on: November 29, 2013, 05:05:45 AM »
I've seen this method of following the character with the camera by attaching it, in an other hutonggames tutorial.

could you post a link to this tutorial please

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: 3rd person issue
« Reply #4 on: November 29, 2013, 05:18:15 AM »

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: 3rd person issue
« Reply #5 on: November 29, 2013, 03:26:34 PM »
Thank you so much I did not know of any of these tutorials.

I am now subscribed and will watch and learn.


Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: 3rd person issue
« Reply #6 on: November 29, 2013, 11:59:12 PM »
Something you might be interested in trying is the "smooth follow" PlayMaker action. I have a third-person camera that follows the character, and rather than parenting it to the character, the action takes care of all that.

I understand that you like the setup you have (especially since it coincides with the tutorial you're watching so it's easy to follow the tut), but if you reach a dead end, give the smooth follow action a shot.

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: 3rd person issue
« Reply #7 on: November 30, 2013, 01:28:08 AM »
I tried the smooth follow, but now when I press backwards direction, the camera starts to rotate around the character.

Any idea, why is it happening?

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: 3rd person issue
« Reply #8 on: November 30, 2013, 01:38:48 AM »
I had this issue for a while when I was developing my character controller - all the movement directions worked fine, except for moving backwards (towards the camera) . It all depends on how your other actions are setup. It sounds like you might have another FSM or action which is moving the character relative to the camera. The tutorial you're following relies on you setting things up exactly the way they do, so when you change just one part of the setup, you get unusual results sometimes.

Try poking around the FSMs responsible for the camera, as well as the FSMs responsible for the character, and see if you can intuit what might be the cause. For me, it was a matter of changing a few lines in the character controller script (not something I'm talented at or comfortable with, by any means, but it worked eventually).

If that sounds scary or if you still have trouble, there's a series of tutorials that setup a similar third-person controller, that you may or may not be interested in looking at:

http://www.youtube.com/watch?feature=player_embedded&v=od78RhlLXUI#t=2

There's a whole series of these on the site (you've probably seen them):

http://www.hutonggames.com/tutorials_getting_started.php

But the one I linked was really useful for getting me started with a basic camera-aware character controller. I just spent the last few weeks wrestling with my character controller and associated scripts (ugh), so let me know if I can help you any further!

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: 3rd person issue
« Reply #9 on: November 30, 2013, 01:44:01 AM »
I used the same tutorial that you linked, and all I did in addition is to set up variables for Mecanim animations. I have no idea what can cause this issue.

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: 3rd person issue
« Reply #10 on: November 30, 2013, 01:47:12 AM »
Yeah, I know that exact frustration.

Can you describe, or take screenshots of, your FSM structure perhaps? Are you using any scripts on the character in addition to the PlayMaker FSMs? (I find that combining the two can sometimes take a little extra effort)

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: 3rd person issue
« Reply #11 on: November 30, 2013, 03:03:49 AM »
I've attached a screenshot of the actions controlling movement. The other actions in the FSM are Set Animator (Variable) actions.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: 3rd person issue
« Reply #12 on: November 30, 2013, 05:38:21 AM »
hello sorry to jump in but possibly you may be able to help me.

How did you take the global movement vector 3 and use this as variables in set animator actions?

I am trying to do a similar thing using get axis vector the global movement and then store the x as x axis and z as z axis these are local values that are exposed in the inspector.

I do this every frame, but the values are always changing when you are moving.

Could you post a screenshot of the FSM were you use the set animator variable please.




ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: 3rd person issue
« Reply #13 on: November 30, 2013, 05:57:29 AM »
Of course, I've attached the screenshot.

Keep in mind that the "Direction" and "MoveSpeed" variables are created in Mecanim AND in the FSM. The variables in Mecanim and in the FSM have nothing to do with each other, unless you link them the way I did. I'm writing this, because it can be confusing that I'm using the same variable names in Mecanim and in the FSM.

I hope this helps, feel free to ask if something is not clear, I'm happy to help.



colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: 3rd person issue
« Reply #14 on: November 30, 2013, 09:51:02 AM »
Thank you.

I am confused the get axis vector gets what key pressed and then stores how much in the global movement.

The controller simple move then moves the object in the correct direction.

It seems that I need to setup another get axis vector to detect what direction I am currently going in?