Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8664443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:14:29+00:00 2026-06-12T17:14:29+00:00

How do I pitch a camera in localspace? I have a model that rotates

  • 0

How do I pitch a camera in localspace?

I have a model that rotates on its its on axis regardless of where it is in worldspace. The problem I’m having is to get the camera to pitch the same regardless other rotation (yaw) of the model. Currently, if the model is facing north or south in worldspace, the camera pitches accordingly. But when the model is facing any other cardinal direction, after trying to pitch the camera, the camera moves up and down in a circular motion behind the model (because it is only recognizing worldspace and not which direction the model is facing).

How do I get the pitch to rotate with the model so that no matter which direction the model is facing? when I try to pitch the camera will move over the model?

// Rotates model and pitches camera on its own axis
    public void modelRotMovement(GamePadState pController)
    {
        /* For rotating the model left or right.
         * Camera maintains distance from model
         * throughout rotation and if model moves 
         * to a new position.
         */

        Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(speedAngleMAX);

        AddRotation = Quaternion.CreateFromYawPitchRoll(Yaw, 0, 0);
        ModelLoad.MRotation *= AddRotation;
        MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation);

        /* Camera pitches vertically around the
         * model. Problem is that the pitch is
         * in worldspace and doesn't take into
         * account if the model is rotated.
         */
        Pitch = pController.ThumbSticks.Right.Y * MathHelper.ToRadians(speedAngleMAX);
    }

    // Orbit (yaw) Camera around model
    public void cameraYaw(Vector3 axisYaw, float yaw)
    {
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisYaw, yaw)) + ModelLoad.camTarget;
    }

    // Pitch Camera around model
    public void cameraPitch(Vector3 axisPitch, float pitch)
    {
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisPitch, pitch)) + ModelLoad.camTarget; 
    }

    public void updateCamera()
    {
        cameraPitch(Vector3.Right, Pitch);
        cameraYaw(Vector3.Up, Yaw);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:14:31+00:00Added an answer on June 12, 2026 at 5:14 pm
    >    public void cameraPitch(Vector3 axisPitch, float pitch)
    >     {
    >         ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
    >             Matrix.CreateFromAxisAngle(axisPitch, pitch)) + ModelLoad.camTarget; 
    >     }
    

    I should have seen this in your last question. sry.

    axisPitch is indeed a global space vector and it needs to be in local space. This should work.

       public void cameraPitch(float pitch)
        {
            Vector3 f = ModelLoad.camTarget - ModelLoad.CameraPos;
            Vector3 axisPitch = Vector3.Cross(Vector3.Up, f);
            axisPitch.Normalize();
            ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
                Matrix.CreateFromAxisAngle(axisPitch, pitch)) + ModelLoad.camTarget; 
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried my best to create a camera that mimics the style of
My problem is related to pitch-shifting audio in Python. I have the current modules
I have now admitted defeat that you cannot use/build a good audio pitch function
I'm trying to get the orientation (Roll, Pitch, Yaw) angles of the mobilePhone using
I have a direction vector that applied to a position gives me the point
I have a Galaxy Note device and I wrote an application that grabs uimages
Possible Duplicate: Real-time Pitch Shifting on the iPhone i have already found the answer
There is a good pitch from Twilio here . I just don't get how
I want to change the pitch of my audio and I know that AV
I have three gyroscope values, pitch, roll and yaw. I would like to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.