Jump to content
  • Advertisement
Sign in to follow this  
EvilWeebl

[xna] Translation problem with transform widget

This topic is 2790 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

Hi all, currently I have implemented a transform widget and have the picking and everything working fine but need some help in determining how far an object should move when I drag the translate arrow.

I had it implemented briefly for testing purposes that the amount of pixels the mouse moves translates the object by so much but obviously that is very disproportionate. I would like it so that I drag the arrow and it stays under my mouse and therefore moves the object correctly.

I have heard of two ways to do this but neither were explained extensively enough on how they were implemented or how effective they were. These are:
  • Build a plane about the selected arrow along its axis and test for collision against that. the intersection point with the distance and direction of the ray gives a position to move by.
  • Project the selected arrow axis into screen space(apparently only using the view matrix rotation) and use the dot product of this axis by the mouse delta and then some other wizardry.
    Could anybody shed some light on the best method to achieve this and how to go about it?

    Any help much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
I found this http://xnagizmo.codeplex.com/ which works really well and relates to the point I made about building a plane. Its not 100% accurate when dragging the arrows but is very close, it just seems over complicated. Can anybody shed some ideas as to how to get better accuracy? Perhaps with the other method I mentioned?

Should I just take this example and adapt it to my level editor?

Any help much appreciated.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!