playMaker

Author Topic: 3rd person controlled with moving back animation  (Read 3449 times)

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
3rd person controlled with moving back animation
« on: August 09, 2013, 03:53:49 PM »
Hello
I am using the 3rd person controller and the smooth rotate action to make the player face the direction he is going.
my problem is i want the player to move backward instead of rotating depending on the player to the camera angle.
how do i get the angle of the player, relative to where the camera is looking at? ( like if the camera is looking at the player back and back button is pressed play the moving backwards animation else rotate the player and move him forward.

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: 3rd person controlled with moving back animation
« Reply #1 on: August 11, 2013, 06:30:16 AM »
Any one have an idea how to achieve this? :-\

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: 3rd person controlled with moving back animation
« Reply #2 on: August 12, 2013, 08:46:26 AM »
Did you guys understand me? jean can you please advice on this.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: 3rd person controlled with moving back animation
« Reply #3 on: August 12, 2013, 04:02:20 PM »
Thing with using the third-person controller where you're rotating the object itself to turn, you're sacrificing a potential node where you can extract rotation.

personally (and this isn't to say that this is what would work for you) I would nest the mesh as a child of the player object, tell the main player object not to move and instead of rotating the object itself, send the vector3 to the mesh object and use that as the "rotate towards" function.

This would help because then you'll be able to extract the rotation of the mesh object and use that as a sort of indicator that you can use to detect what direction the player is facing so as to hook up an animation system to handle it.

though, to be honest, this is a rather broad question and the solution is rather complex so please understand that that could be why there hasn't been much traction on this thread so far.

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: 3rd person controlled with moving back animation
« Reply #4 on: August 12, 2013, 08:08:23 PM »
Thanks Red for your help

Is it so complex to get the rotation of the player relative to the camera forward vector? that is strange. also I'm going to try adding a state to check the current animator state of the player and if in idle and his forward is in line or close to the camera forward angle then the S key will make the player animate backward else go to the state where the S key will rotate the player and make him animate forward.
does this seam logical to you?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: 3rd person controlled with moving back animation
« Reply #5 on: August 14, 2013, 04:42:39 AM »
Hi,

 the best way to get that is to get the velocity of the object, which will give you de facto the direction.

 I have made a small missile system where I align the missile using the velocity so it appears to follow its own trajectory.

http://hutonggames.com/playmakerforum/index.php?topic=4477.msg21719#msg21719

now to invert this, simply play with vectors to invert the direction ( multiply by -1)

does that help?

bye,

Jean