# LookAt horizontal

Hi any one know how can i make a similar method to look at but to make it rotate a body only horizontally ?
Lets say i have a soldier ,and i need to make it look at a soldier at his left and a bit lower .
But i need it only to yaw .
What i tried (probably wrong at all ) is :

``````            this.getNodeBody().lookAt(new
Vector3f(getWayPoint().getX(),getNodeBody().getLocalTranslation().getY()
,getWayPoint().getY()).
normalize(),
Vector3f.ZERO);
``````

but the problem is now whole soldier starts to rotate upside down and its not what i looking for

I tried this as well

``````   this.getNodeBody().lookAt(new Vector3f(getWayPoint().getX(),getNodeBody().getLocalTranslation().getY()
,getWayPoint().getY()).
normalize(),
new Vector3f(0, 0, 0)``````

Advice: you will have a muuuuch easier time if you go ahead and split your lines up rather than trying to write a whole program on one line. For example, you can insert printlns, etc. to see whatâ€™s really going on.

Anyway, your real problem is that youâ€™ve decided to randomly pass Vector3f.ZERO as the â€śup directionâ€ťâ€¦ which canâ€™t possibly right and Iâ€™m surprised you get a value at all, really.

Well i suppose that main problem is still im not mutch with directions and stuff. I really hoped lookAt method was like look at and then give the point , while it will do every thing on alone â€¦ but
aaahâ€¦

Okâ€¦

Look at this dot right here: .

Which way is the top of your head facing?

Now, turn your head sideways and look at that dot again.

Now which way is the top of your head facing?

If I just told you â€ślook at that dotâ€ťâ€¦ how would you know which way to look at that dot?

Answer: I would have to tell you what â€śUPâ€ť is. Else, I might walk in with you standing on your head when I wanted you sitting in your chair.

99% sure this is all covered in the math tutorials at the top of the page.

Men i will tell you the true .I gave them a read ,did not achived mutch ,and said to my self , try do all the other code to make the game be a game and work , and just hope to get directions work some how (and rotations) . I have tons of stuff and content up here . My game is a hybrid of RTS RPG RTT FPS ECONOMY . Its trully huge , but with a Minecraft graphycs and bent directions,rotations â€¦ aah

I have lords ,knights ,merchants,phesants, artisans , mercenaries .several government systems and holding types ,really tons of stuff and it all has it brains balance and more .
But when i got tons of classes and content for game , realized huge problem ,graphycs makes me cry , and direction/rotation is bent

1 Like

Problem SOLVED , THANX for attention and help .