# Gameplay What are Some Real Game/Simulator Examples that Use Rotation Around a Point?

## Recommended Posts

I'm having a great time with the OpenGL.  I have a question though, what sorts of ways can the glm::lookAt command be used in simulators and games.  As I am understanding, this command allows us to rotate around a point and look inward.  Could I have some real life (diverse) game/simulator descriptions or captured game/simulator images, please?

Thank You,

Josheir

##### Share on other sites
34 minutes ago, Josheir said:

Could I have some real life (diverse) game/simulator descriptions or captured game/simulator images, please?

Example is about anything that you can see on any 3D game. LookAt mainly used to convert camera frame (basis) that used for navigating camera into world to view matrix that used for rendering.

Edited by Fulcrum.013

##### Share on other sites

Oh, okay,  There are many questions on the internet asking about rotation around a point.  I was wondering what the idea is.  Say there is a tower in a 3d game, one could use a keypress to rotate around it , perhaps?

Thanks, Flucrum.013,

Josheir

##### Share on other sites

A very specific example would be having a camera in a 3D game following a player and LookAt the player's coordinates to calculate the new rotation/etc...  Or LookAt whatever it is the player is clicking on/etc...

##### Share on other sites
2 minutes ago, Josheir said:

Say there is a tower in a 3d game, one could use a keypress to rotate around it , perhaps?

You have to use a local rotation for tower, or/and frames tree to rotate turret respectively to its base, not to world basis

##### Share on other sites

And I think you may have it confused, it's not rotating anything.  It's creating a viewing matrix based on an origin(eye) position, the(center) position of the Looked At, and the Up vector of the(eye).  This can be used to rotate your view towards the (center) point.  If I'm not reading the docs wrong.

##### Share on other sites
1 minute ago, Septopus said:

This can be used to rotate your view towards the (center) point.

Really view transform is rotation of world in direction backward then actual camera rotation. So of cource it can be used to some triks with rotations, that allow to set a z axe of basis looking to given point, but personally im prefer to use custom made lookTo function that works similar but perform a just a rotation instead inversed to calculate positions of basis.

##### Share on other sites

Yeah, you are right...  I read it wrong.. haha.  So you could use it for what I was saying but you would have to invert it...

##### Share on other sites

What is a frame tree?

##### Share on other sites

Well, I dunno now..  this seems to be saying I was right.

"To create the view transformation, GLM offers the useful glm::lookAt function that simulates a moving camera. The first parameter specifies the position of the camera, the second the point to be centered on-screen and the third the up axis. Here up is defined as the Z axis, which implies that the XY plane is the 'ground'."

But this is not my area of expertise, so I will leave you with that.   Hope it helps somehow.

Edited by Septopus

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634106
• Total Posts
3015548
×