playMaker

Author Topic: Make object always looking at the player  (Read 525 times)

NN2

  • Playmaker Newbie
  • *
  • Posts: 20
Make object always looking at the player
« on: April 01, 2021, 01:24:01 PM »
Hi, so this is not about smooth look at question (or maybe it is..)

I am now trying to make push/pull object and everything works great except for one problem.
I want the object that I'm pulling to always look at me, so it gives a feeling that it is actually following the player.
However, when I use smooth look at, the pulling object rotates until its Z-axis look at the player.
What I want to do is something like in this video from 0:13 to 0:23. The dog holding a green gummy bear.


I'm not sure how the gummy bear can stick to the dog's hands and change it's rotation (following the player)
I hope this makes sense! Please let me know anything is not clear.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Make object always looking at the player
« Reply #1 on: April 01, 2021, 04:09:17 PM »
Hi.
It looks like it has some king of spring joint and because the chin is hitting the object its not wiggling.

but you could have something like 'on holding' , look forward.

you can use 2 empty object to make a target to look at.

parent object 2 to object 1.

depending on the parenting of you player you can parent to the root or body
else don't parent, but use get/set position. and use a 3rd object in the parent tree.
get position from the head and set position on object 1.
also get/set the rotation on object 1. (all in world space)

object 2 you can now rotate in 1 direction x,y or z in local space
object 3 (child from object 2) you can set to a distance in front of the player.

let the head look to that object (3)

by setting rotation on object 2 you can change the direction to look at.

then for example if holding left hand, let it look more to the left
if right more to right and if both hands holding, rotate to look forward.