Author Topic: Suggestions for Ultima 4.0 Alpha 2  (Read 2829 times)

Yare

  • *
  • Posts: 17
    • View Profile
Suggestions for Ultima 4.0 Alpha 2
« on: 2004-07-09 05:09:49 »
I only have 3 major beefs with this program:

1) The vertex editing window should really be a sidebar on the left that is always visible. Drop the "Save vertex" button and make all changes immediately reflected in the view window on the right.

2) Selecting a vertex color should not be limited to hand-inputting RGB values. Adding in a drop-down color pallet to fill in the values automagically would be very simple to do (there's already windows controls for it) AND if you implement step (1) above, you can have the color of the vertice updated in real time as the user drags the color selector around to see what value is best.

3) Selecting vertices by mouseclick would make this a positively killer tool. Create a new tool on the toolbar called "select", and then let the user click to select a vertice. If you implement step (1) above, the newly selected vertex's info would appear to the left, ready for editing. If you are unsure how to go about doing this -here's the psuedocode:

a) While updating the scene, detect mouseclicks.
b) If there was a mouseclick in the viewport and the tool is set to "select", then shoot a ray into the viewport.
c) Grab the first triangle the ray from the mouse intersects with.
d) Transform the coordinates of the 3 vertices from that triangle into screen coordinates, do the same with the mouse ray.
e) Use the distance formula to determine which vertice of the triangle is closest to the mouse ray, and highlight/select that vertice.

This was the first algorithm that came to mind. Its probably not the most effecient. Hell, you could probably just convert every vert to screen coordinates every frame and check which was closest to the mouse ray. I believe there is a DirectX SDK sample that shows how to select triangles based on mouseclicks. It could probably explain better than I could!

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Suggestions for Ultima 4.0 Alpha 2
« Reply #1 on: 2004-07-09 06:38:02 »
Im not sure how would that formula work with perspective view ... but there are few solutions for it on the net..

Yare

  • *
  • Posts: 17
    • View Profile
Suggestions for Ultima 4.0 Alpha 2
« Reply #2 on: 2004-07-09 22:28:44 »
Well, using ray intersection should work during any step during the transformation process.

Another option, however, would be to check for clicks after the scene has been transformed into screen coordinates. You could then just check the mouse x/y value against the now 2-dimensional vertex x/y coordinates. Or something.

Anyway, there are several different ways to go about doing it, none of which are incredibly simple, but all of the ways can be found in the internet, I'd bet.