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 8863411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:58:17+00:00 2026-06-14T15:58:17+00:00

I have an object in my game that has a few meshes and when

  • 0

I have an object in my game that has a few meshes and when I try to rotate either of the meshes either way, it only rotates it around world axis, and not its local axis. I have a rotation = Matrix.Identity in a class constructor. Every mesh has this class attached to it. Then this class also contains methods:

...
public Matrix Transform{ get; set; }
public void Rotate(Vector3 newRot)
{
    rotation = Matrix.Identity;
    rotation *= Matrix.CreateFromAxisAngle(rotation.Up, MathHelper.ToRadians(newRot.X));
    rotation *= Matrix.CreateFromAxisAngle(rotation.Right, MathHelper.ToRadians(newRot.Y));
    rotation *= Matrix.CreateFromAxisAngle(rotation.Forward, MathHelper.ToRadians(newRot.Z));

    CreateMatrix();
}

private void CreateMatrix()
{
    Transform = Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(Position);
}
...

And now the Draw() method:

foreach (MeshProperties mesh in model.meshes)
{
    foreach (BasicEffect effect in mesh.Mesh.Effects)//Where Mesh is a ModelMesh that this class contains information about
    {
        effect.View = cam.view;
        effect.Projection = cam.projection;
        effect.World = mesh.Transform;
        effect.EnableDefaultLighting();
    }
    mesh.Mesh.Draw();
}

EDIT:
I am afraid either I screwed somewhere up, or your tehnique does not work, this is what I did. Whenever I move the whole object(Parent), I set its Vector3 Position; to that new value. I also set every MeshProperties Vector3 Position; to that value. And then inside CreateMatrix() of MeshProperties I did like so:

...
Transform = RotationMatrix * Matrix.CreateScale(x, y, z) * RotationMatrix * Matrix.CreateTranslation(Position) * Matrix.CreateTranslation(Parent.Position);
...

Where:

public void Rotate(Vector3 newRot)
{
    Rotation = newRot;
    RotationMatrix = Matrix.CreateFromAxisAngle(Transform.Up,          MathHelper.ToRadians(Rotation.X)) * 
    Matrix.CreateFromAxisAngle(Transform.Forward, MathHelper.ToRadians(Rotation.Z)) * 
    Matrix.CreateFromAxisAngle(Transform.Right, MathHelper.ToRadians(Rotation.Y));
}

And Rotation is Vector3.
RotationMatrix and Transform are both set to Matrix.Identity in the constructor.

The problem is if I try to rotate around for example Y axis, he should rotate in a circle while “standing still”. But he moves around while rotating.

  • 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-14T15:58:18+00:00Added an answer on June 14, 2026 at 3:58 pm

    The problem was that, when I was exporting model as .FBX the pivot point wasnt in model centre. Thus making the model move while rotating.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: object that has object_id column and avalues that have object_id
I think I read somewhere that some modules only have object oriented interfaces (
So I have this model Game that has an Awayteam and Hometeam field. Now
I have a game on Facebook that has been running successfully for almost a
I have an object named game which has a property called channels (which is
I have a Game class that has a -(void) play method which will be
I have a game that uses layers as a way to organize depth. It
I have an object: POP_CULTURE_TYPES = ( ('SG','Song'), ('MV', 'Movie'), ('GM', 'Game'), ('TV', 'TV'),
I am working on a game that has AI logic, movement, etc and drawing.
I'm building a game in as3 that has balls moving and bouncing off the

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.