Views: 19,857,226 |
Home
| Forums
| Uploader
| Wiki
| Object databases
| IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search |
03-29-24 03:52 PM |
Guest: |
0 users reading Need help converting triangle formats! | 1 bot |
Main - Misc. ROM hacking - Need help converting triangle formats! | Hide post layouts | New reply |
Yoshimaster96 |
| ||
Member Normal user Level: 39 Posts: 93/345 EXP: 375508 Next: 29263 Since: 11-03-14 Last post: 1920 days ago Last view: 862 days ago |
GMA files store the vertices of a triangle as 3 XYZ coordinates. But for collision, LZ files store the vertices as follows:
Posted by LZ.TXT For clarification, first coordinate is (x1,y1,z1), second coordinate is calculated as (x1+dx2x1,y1+dy2y1,z1), rotated about first point by x angle, y angle, and z angle, in the order specified above. Third coordinate is calculated similarly, from (x1+dx3x1,y1+dy3y1,z1), rotated by the same angles. The ?s are unknown, but I think they're tangent and bitangent/binormal. So how would I convert from GMA triangle to LZ triangle? |
blank |
| ||
Normal user Level: 26 Posts: 125/129 EXP: 95876 Next: 6399 Since: 07-08-12 Last post: 3315 days ago Last view: 2287 days ago |
This is python code that converts a triangle given by the vertices a, b and c:
Here v0 and v1 corresponds to your (dx2x1,dy2y1) and (dx3x1,dy3y1) and n0 and n1 corresponds to your unknowns. Also, have you noticed that the collision is divided into a grid? |
Yoshimaster96 |
| ||
Member Normal user Level: 39 Posts: 103/345 EXP: 375508 Next: 29263 Since: 11-03-14 Last post: 1920 days ago Last view: 862 days ago |
Posted by blank Tried to convert this to C# (as that is the language of my program), but I got stuck. How are cx, cy, cz, sx, sy, and sz defined? |
blank |
| ||
Normal user Level: 26 Posts: 126/129 EXP: 95876 Next: 6399 Since: 07-08-12 Last post: 3315 days ago Last view: 2287 days ago |
cx, sx, cy, sy, cz and sz are floats and are the cosine and sine of the rotation angles. |
Yoshimaster96 |
| ||
Member Normal user Level: 39 Posts: 105/345 EXP: 375508 Next: 29263 Since: 11-03-14 Last post: 1920 days ago Last view: 862 days ago |
Posted by blankThose aren't given however. I'm trying to find the rotation angles. |
blank |
| ||
Normal user Level: 26 Posts: 127/129 EXP: 95876 Next: 6399 Since: 07-08-12 Last post: 3315 days ago Last view: 2287 days ago |
You calculate the angles using cx, sx, etc. In my code snippet this is done with the reverse_angle function. |
Yoshimaster96 |
| ||
Member Normal user Level: 39 Posts: 106/345 EXP: 375508 Next: 29263 Since: 11-03-14 Last post: 1920 days ago Last view: 862 days ago |
You don't get it? I'm given coordinates, and am trying to find angles. I can't find sine and cosine of angles I don't know. |
Kinnay |
| ||
Member Normal user Level: 19 Posts: 7/66 EXP: 31095 Next: 4682 Since: 01-13-15 From: Netherlands / Germany Last post: 3160 days ago Last view: 3124 days ago |
Hmm, not sure if that's what you meant, but you can find angles in a triangle if you know the length of the sides with the cosine rule. You can easily calculate the lengths of the sides if you know the coordinates. |
blank |
| ||
Normal user Level: 26 Posts: 128/129 EXP: 95876 Next: 6399 Since: 07-08-12 Last post: 3315 days ago Last view: 2287 days ago |
The code specifically shows how to calculate cx, sx, etc. without first calculating the angles. |
Main - Misc. ROM hacking - Need help converting triangle formats! | Hide post layouts | New reply |
Page rendered in 0.024 seconds. (2048KB of memory used) MySQL - queries: 28, rows: 122/122, time: 0.008 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |