[xna] Translation problem with transform widget

Started by
0 comments, last by EvilWeebl 12 years, 11 months ago
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.
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.

This topic is closed to new replies.

Advertisement