playMaker

Author Topic: Smooth look at direction override player rotation.[SOLVED]  (Read 249 times)

hoyoyo80

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Smooth look at direction override player rotation.[SOLVED]
« on: July 10, 2019, 10:44:05 PM »
Hi all,

I think the problem is simple, maybe due to over immersive into developement i get clueless about this.

Let say i have two state.

State 1 - Wait Input key for direction using Get Axis Vector and Smooth Look at           
              Direction
            - Wait for a key down and to turn the direction of the player(Player     
              Facing) and go to State 2

State 2 - Rotate the player for a certain angle and finished go back to State 1

Here, after go back to State 1,the player dont preserve the new facing angle,instead it goes back to its previous facing direction.

Anyway to override this?

Thanks
« Last Edit: July 12, 2019, 12:11:00 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14342
  • Official Playmaker Support
    • View Profile
Re: Smooth look at direction override player rotation.
« Reply #1 on: July 11, 2019, 01:04:08 AM »
Hi,

 I think, it's because you have two different mode, one is accessing the rotation of the object directly, and the other is incrementaly rotating, so when you switch, you can't keep the rotation as it is. Or you are on one hand changing the look at target, and on the other hand actually rotating the object, which also leads to inconsistency.

the smooth look at should always be active, and then you should only change the target.

Bye,

 Jean

hoyoyo80

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Re: Smooth look at direction override player rotation.
« Reply #2 on: July 11, 2019, 01:24:42 AM »
Hi and thanks to you.

Any detail suggestions to combat the above siuation? It useful if the player move and come with contact an npc/switch and want to face at that direction. 😅

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14342
  • Official Playmaker Support
    • View Profile
Re: Smooth look at direction override player rotation.
« Reply #3 on: July 11, 2019, 01:41:37 AM »
Hi,

Sure: I usually do this:

- I create a dummy gameobject that act as the target.
- In user control mode, I rotate this dummy around the character,
- In gameologic control mode, I usually parent or follow another target like the enemy

then my player is only dealing with looking at the dummy, and it do no care about how that dummy moves.

Does that make sense?

Bye,

 Jean

hoyoyo80

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Re: Smooth look at direction override player rotation.
« Reply #4 on: July 11, 2019, 01:54:22 AM »
I kindof get it. But thats mean Get axis vector will use these dummy object as a reference for Smooth Look At Direction?

Thanks for the idea, is kinda lit something😁

hoyoyo80

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Re: Smooth look at direction override player rotation.
« Reply #5 on: July 11, 2019, 07:53:35 PM »
Hi,

manage to solve but maybe it is not so neat but it is working.
what i did is : every time i use Look At i will use Get Forward Direction action to get new facing vector3 and set the vector3 value of variable that is used in Smooth Look at direction.Now the player wont snap back to previous facing direction before using look at.

But JeanFabre, im interested in your method. Care to come out with tutorial.Its sound like a clever solution.Thanks BTW

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14342
  • Official Playmaker Support
    • View Profile
Re: Smooth look at direction override player rotation.
« Reply #6 on: July 12, 2019, 12:10:49 AM »
Hi,

 Indeed your solution is absolutely correct, you clearly understood the issue.

I am in catch up mode at the moment, so I can't promess any new tutorials or samples, but bump me in a week or two, I'll likely be in a better position to make a quick sample.

 Bye,

 Jean