Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Rotating around fixed axis

Rotating around fixed axis

Scheduled Pinned Locked Moved Graphics
4 Posts 3 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    error1408
    wrote on last edited by
    #1

    Hi, I want to rotate a mesh around a FIXED axis that does not rotate like the axis of the mesh itself. thats my code so far: device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(x, y, z); But whith that code the mesh rotates around the axis of itself.

    A K 2 Replies Last reply
    0
    • E error1408

      Hi, I want to rotate a mesh around a FIXED axis that does not rotate like the axis of the mesh itself. thats my code so far: device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(x, y, z); But whith that code the mesh rotates around the axis of itself.

      A Offline
      A Offline
      andre_swnpl
      wrote on last edited by
      #2

      Try swapping the rotation Matrix and the translation matrix like this.

      device.Transform.World = Matrix.Translation(x, y, z) * Matrix.RotationYawPitchRoll(yaw, pitch, roll);

      E 1 Reply Last reply
      0
      • A andre_swnpl

        Try swapping the rotation Matrix and the translation matrix like this.

        device.Transform.World = Matrix.Translation(x, y, z) * Matrix.RotationYawPitchRoll(yaw, pitch, roll);

        E Offline
        E Offline
        error1408
        wrote on last edited by
        #3

        Doesn't have any effect :( Has nobody else any idea?

        1 Reply Last reply
        0
        • E error1408

          Hi, I want to rotate a mesh around a FIXED axis that does not rotate like the axis of the mesh itself. thats my code so far: device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(x, y, z); But whith that code the mesh rotates around the axis of itself.

          K Offline
          K Offline
          kenearle
          wrote on last edited by
          #4

          This might be a little vague, but better than nothing I hope. One way to rotate about an arbitrary axis (there are others): - find the unique point on the axis such that a line from that point to the origin is perpendicular to the axis - let's suppose the point is 1,2,3 -translate that point to the origin - Translation(-1,-2,-3) -do the rotation -undo the translation - Translation(1,2,3) Hope that helps a bit

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups