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. C / C++ / MFC
  4. DirectX9 - 3d object translating with sine wave pattern ...

DirectX9 - 3d object translating with sine wave pattern ...

Scheduled Pinned Locked Moved C / C++ / MFC
regextutorialquestion
4 Posts 2 Posters 0 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.
  • J Offline
    J Offline
    jc0dex
    wrote on last edited by
    #1

    does anyone know how to get an object moving along the path of a sine wave? I've got my object translating across the screen with simple matrix multiplication in DX9 but I can't figure out the sine wave path. anyone have any ideas?

    A 1 Reply Last reply
    0
    • J jc0dex

      does anyone know how to get an object moving along the path of a sine wave? I've got my object translating across the screen with simple matrix multiplication in DX9 but I can't figure out the sine wave path. anyone have any ideas?

      A Offline
      A Offline
      Alexander M
      wrote on last edited by
      #2

      Move the world matrix of that object according to the sine wave. The position of the matrix is a vector with 3 components, so create a function that returns a "sine wave" vector by giving the relative or absolute time (depends on your timing model) as function parameter and add the result vector's components to the position values of the world matrix. How such a function should look like is quite easy. I think you want to use the y-axis as magnitude of the wave. So: y = sin("angular velocity" * t); Then you have to define a movement vector for spreading directon of the wave (let's call it v). x = v.x * t; z = v.z * t; I hope that helps... Regards, Alex Don't try it, just do it! ;-)

      J 2 Replies Last reply
      0
      • A Alexander M

        Move the world matrix of that object according to the sine wave. The position of the matrix is a vector with 3 components, so create a function that returns a "sine wave" vector by giving the relative or absolute time (depends on your timing model) as function parameter and add the result vector's components to the position values of the world matrix. How such a function should look like is quite easy. I think you want to use the y-axis as magnitude of the wave. So: y = sin("angular velocity" * t); Then you have to define a movement vector for spreading directon of the wave (let's call it v). x = v.x * t; z = v.z * t; I hope that helps... Regards, Alex Don't try it, just do it! ;-)

        J Offline
        J Offline
        jc0dex
        wrote on last edited by
        #3

        Wow .. def gonna do that man. I'll report results. Thanks for quick reply.

        1 Reply Last reply
        0
        • A Alexander M

          Move the world matrix of that object according to the sine wave. The position of the matrix is a vector with 3 components, so create a function that returns a "sine wave" vector by giving the relative or absolute time (depends on your timing model) as function parameter and add the result vector's components to the position values of the world matrix. How such a function should look like is quite easy. I think you want to use the y-axis as magnitude of the wave. So: y = sin("angular velocity" * t); Then you have to define a movement vector for spreading directon of the wave (let's call it v). x = v.x * t; z = v.z * t; I hope that helps... Regards, Alex Don't try it, just do it! ;-)

          J Offline
          J Offline
          jc0dex
          wrote on last edited by
          #4

          I guess I don't fully understand. I've got my timer around my render function so it only renders if the time is more than a certain value. What exactly do you mean give the relative or absolute time to the "sine wave" function? Also what would I use to calculate my angular velocity and my movement vector? I think I'm starting to understand, thanks a lot for you help. j

          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