LookAt horizontal


#1

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


#2

I tried this as well

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

#3

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.


#4

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…


#5

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.


#6

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 :smiley: and bent directions,rotations … aah


#7

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 :smiley: .
But when i got tons of classes and content for game , realized huge problem ,graphycs makes me cry :smiley: , and direction/rotation is bent


#8

Problem SOLVED , THANX for attention and help .