Jump to content
• Advertisement

# Help, my arcball always rotates around the origin! -Problem kicking me in my arcballs

This topic is 3933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hello, I spent some hours today implementing arcball rotation for a level editor I'm coding. It's working fine, as long as I don't do any panning or zooming of the camera. When I do that, the rotation still takes place around the origin, not the kind of behaviour you would expect from a level editor. Any idea how I can rotate around where I'm looking at (view vector), instead of the origin? PS: my implementation is based on the arcball code from NeHe lesson 48 Thanx in advance, Jeroen

#### Share this post

##### Share on other sites
Advertisement
You need to translate the direction vector by the position vector, AFTER the rotation.

#### Share this post

##### Share on other sites
Hello,

this would be very simple to do if I actually rotated the camera around the world, but instead I have until now avoided this by rotating the world. I guess everything would be simpler if I rotated the camera instead of the world. The problem is I don't know how to do that. I tried a couple of things like multiplying my rotation matrix with the position vector of the camera, but it doesn't work like expected. So the new question is: how can I apply the rotation matrix I get from my arcball functions to modify the camera position instead of the world?

Any help would be greatly appreciated,
Jeroen

#### Share this post

##### Share on other sites
Ok, it's been a few days now and can't seem to figure out a solution. Can anyone tell me how to apply the rotation matrix I get from my arcball class to my camera? I tried taking the inverse of the rotation matrix and multiply that with my camera's position, and sometimes it almost seems to work but it's very twitchy.

PS: Eventually I want to use this to solve my problem above. I can't find any samples that do translation with an arcball camera. All the samples I've seen rotate around the origin, which already works perfectly. If you know of any samples or know how to do it yourself, please let me know.

Thank you for your time!
Jeroen

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 9
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009388
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!