playMaker

Author Topic: Lock smooth look at function axis. [SOLVED]  (Read 116 times)

agito1987

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Lock smooth look at function axis. [SOLVED]
« on: September 11, 2017, 04:40:13 AM »
Hey

I just asked a question about smooth roll movement here on the forum and I thought that I had figured it out.

I wanted smooth movement to rotate my player in a shmup like game on the y axis using a controller.
I use an object in front of the player to roll him to the left and right.
This works great and I get the movement I want.

However my problem now is that when I rotate the player, the smooth look at counters the rotation and treats the object like it’s a head. Not rotating in the z axis (it stays y axis op in world space).

My question now is:
How can I let the look at function adjust to the rotation of the tracked object for the roll?
Or lock the z axes so the object follows only on the y axis?

I tried to set the up vector to always check the world space y of the player and setting the up vector of the smooth look at according. And of course inside of the look at function the up vector y to 1. But this doesn’t work.

Attached an image to clarify what my result right now is and wat I want to achieve.
« Last Edit: September 21, 2017, 10:04:08 AM by agito1987 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Lock smooth look at function axis.
« Reply #1 on: September 12, 2017, 01:26:22 AM »
Hi,

 you likely need to add a level of indirection with a dummy parent and then your player mesh, so that when you rotate this way, you rotate the child, not the parent, and each gameobject is then responsible for a sub part of the whole player behaviour.

 Bye,

 Jean

agito1987

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Re: Lock smooth look at function axis.
« Reply #2 on: September 21, 2017, 10:03:15 AM »
Solved this issue by having a separate object with the smooth look at.
Object only goes right and left. Now I use get rotation from that object and use it on the main object with set rotation.

(First I send the gotten rotation float to the main fsm but this dident work, don’t know why =/ )