Kuribo64
Views: 14,248,140 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
05-08-21 01:07 PM
Guest:

0 users reading Looking into SM64DS fixing collision | 1 bot

Main - General SM64DS hacking - Looking into SM64DS fixing collision Thread closed

Pages: 1 2 3 4 5
Fiachra
Posted on 12-30-12 03:41 PM (rev. 3 of 12-30-12 03:53 PM) Link | #2489
When exporting .OBJ from Sketchup (I used this plugin https://sites.google.com/site/messiaen64/level-importer/ObjExporter.rb?attredirects=0) make sure you don't tick "Guess faces to export", but do tick "Front Faces". I think the plugin may be assuming that with a strip of triangles, the normals alternate.

Edit:
Looks like it should work now:

[image]

and here's the Sketchup OBJ Export dialogue:

[image]

ray
Posted on 12-30-12 03:59 PM (rev. 2 of 12-30-12 03:59 PM) Link | #2490
I don't know what is going on. I used your plugin (I normally use the Sketchup export) and somehow everything is different:

1. I imported it into the Game -> KCL IS triangulated, even if I didn't triangulate it.
2. The game DOES NOT crash, even if the triangulated model has waay more than 2048 faces.
3. The Textures look PERFECT (Sketchup exporter makes them darker and such)
4. The model is mirrored on the Z axis.
5. Actually, some of the faces can't be seen after importing. It's like you said, they are facing inside, but that only happens after triangulating.
6. I have no idea what to do.


EDIT: What did you do that it works? o0

____________________
Check out my Patreon Page if you want to support me :)



Arisotura
Posted on 12-30-12 04:07 PM Link | #2491
Note: there's more than one OBJ exporter plugin for SketchUp. Some out there suck, so make sure to choose the right one.

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Fiachra
Posted on 12-30-12 04:46 PM Link | #2492
Posted by ray
...
4. The model is mirrored on the Z axis.
5. Actually, some of the faces can't be seen after importing. It's like you said, they are facing inside, but that only happens after triangulating.
6. I have no idea what to do.


4. Import the .obj model into Blender. Right-click on it. Select Object>Mirror>Z Global
This should flip it on its Z axis (if it asks you to select and axis, press 'Z' on the keyboard). There is an option when importing the model to flip Z axis but I just realised that I didn't implement that for the new collision importing so it will flip the model but not the collision.
5. When I left the textures as they were the game crashed because the "yellow-coin.png" one is too large. Resizing that causes only part of the face to be visible. I noticed that the larger its resolution, the more of it can be seen in the game. All faces actually are visible, the game just crashes loading their textures.
The collision is also perfect now.
6. If you can get the coin model textures resized properly, then your model should look fine in the game.

If you can't get it working I'll try and fix it tomorrow for you.

ray
Posted on 12-30-12 04:57 PM Link | #2493
Posted by Fiachra
4. Import the .obj model into Blender. Right-click on it. Select Object>Mirror>Z Global
This should flip it on its Z axis (if it asks you to select and axis, press 'Z' on the keyboard). There is an option when importing the model to flip Z axis but I just realised that I didn't implement that for the new collision importing so it will flip the model but not the collision.
5. When I left the textures as they were the game crashed because the "yellow-coin.png" one is too large. Resizing that causes only part of the face to be visible. I noticed that the larger its resolution, the more of it can be seen in the game. All faces actually are visible, the game just crashes loading their textures.
The collision is also perfect now.
6. If you can get the coin model textures resized properly, then your model should look fine in the game.

If you can't get it working I'll try and fix it tomorrow for you.


Wait what? How the hell did you fix the collision now? It just doesn't work for me. And yes I noticed the coin-texture-thing and it's already fixed here on my Computer. Just the Collision fails.

____________________
Check out my Patreon Page if you want to support me :)



Skelux
Posted on 12-30-12 10:20 PM (rev. 4 of 12-30-12 10:29 PM) Link | #2494
Well, I'm a little more confused and concerned about the freezing stars now. Almost every star freezes on contact. I imported a level over the wing cap course, placed 8 red coins and a star spawner with the exact same parameters, but It still froze. Any ideas?

Edit: It only seems to be in my star road rom. It happens on stars that zoom the camera out when you collect them. Any idea what files may be responsible for this? Could you tell me which files handle what objects are in a level, so I can just move them over to a fresh rom?

Fiachra
Posted on 12-31-12 05:28 AM (rev. 2 of 12-31-12 02:41 PM) Link | #2504
Skelux:
Are you deleting the original star in the level? Maybe it freezes because there's a duplicate? Not really sure. What happens if, instead of adding a new star you just move the original star object's position and the star act that it appears in?
I don't know why it would only happen in your rom, maybe Mega-Mario can help more with this. In a patched rom, the level data (including objects) are stored in overlays 103 - 154. You should be able to copy these to a new patched rom. Use Nitro Explorer or NSMBe so as not to corrupt the ROM header.

Ray:
You're right, the collision on the coins isn't right, I hadn't noticed because I imported them with a small scale. It's definitely a problem with the normals on the coins, the exporter seems to think some of the outside faces are on the inside. Strangely, flipping the normals of those faces didn't work. Also, the player falling out of the sky is just with your model. I'll see if I can get it exporting properly and will let you know.

ray
Posted on 12-31-12 05:56 AM Link | #2505
Posted by Fiachra
Also, the player falling out of the sky is just with your model.


What do you mean?

____________________
Check out my Patreon Page if you want to support me :)



Fiachra
Posted on 12-31-12 06:14 AM Link | #2506
Posted by ray
Posted by Fiachra
Also, the player falling out of the sky is just with your model.


What do you mean?


Whenever I import your model, the camera is pointed up at the sky. After a few seconds you can see the player falling from the sky and then hits the gound and loses about half his health. I tried a different OBJ Export plugin and the same thing happens but the coins are even worse using this plugin (http://www.sendspace.com/file/w945la). One time I messed up the model, can't remember how and the player started in the right place. Weird.

ray
Posted on 12-31-12 06:52 AM Link | #2507
Hm, for me the player starts at the right position.

____________________
Check out my Patreon Page if you want to support me :)



Fiachra
Posted on 12-31-12 07:51 AM Link | #2509
Posted by ray
Hm, for me the player starts at the right position.

That's good then.

Unfortunately I couldn't get the coin working as the sloped parts just wouldn't export properly. Maybe you can try using one of these models:

http://sketchup.google.com/3dwarehouse/details?mid=85028b9f1057fb63d2191f7229b07ca6&prevstart=0
http://sketchup.google.com/3dwarehouse/details?mid=252889819ee1e5165a51ab55e054a42a&prevstart=0

and give them the old coin's texture. Ones like this shouldn't case a problem when exporting as they're not sloped on the inside.

ray
Posted on 12-31-12 07:57 AM Link | #2510
Okay thanks, I'll try when I find the time for it. The reason why I didn't want to use them, was the light. The coins I now have, have shadows, created by the texture. But the other ones are just one color, and it looks like ONE big face in SM64DS itself, since we can't add shadows/light.

____________________
Check out my Patreon Page if you want to support me :)



Fiachra
Posted on 12-31-12 09:59 AM (rev. 5 of 12-31-12 03:28 PM) Link | #2531
OK, turns out there was a problem with the collision! Two actually. (Sorry Ray)!

This line:
if (cross(v.sub(u), w.sub(u)).norm_sq() < 0.001) { continue; } //#TODO: find a better solution

was getting rid of very small faces, like the ones on the inside of the coin - the coins now work.

Also this:
int result = (int)(ix*this.magic_x + iy*this.magic_y + iz*this.magic_z) % this.num_buckets;

Sometimes num_buckets could be equal to zero if there were fewer than 256 triangles in the model (problem is also in blank's script, download fix here: http://www.sendspace.com/file/yyj6e8). I've fixed this problem as well in the editor (code added to repo).

Ray: What scale are you using for your model? I'm still having the player fall out of the sky.

I've noticed this problem with other models - especially small models and sometimes when otherwise fine models are scaled.

Edit: The problem with falling from the sky isn't just SM64DSe - it happens when using blank's script as well. When I was trying to get it working this usually happened if the octree wasn't right - maybe it's being made too large?

Edit 2: Importing the same model to replace an object's model doesn't cause any problems. Maybe the game expects a level model' size to be within a certain range? Also, I realised there was a problem with importing an object model in that it replaced the level's model/collision instead - this has now been fixed in the latest commit.

Skelux
Posted on 12-31-12 08:51 PM Link | #2581
Posted by Fiachra
Skelux:
Are you deleting the original star in the level? Maybe it freezes because there's a duplicate? Not really sure. What happens if, instead of adding a new star you just move the original star object's position and the star act that it appears in?
I don't know why it would only happen in your rom, maybe Mega-Mario can help more with this. In a patched rom, the level data (including objects) are stored in overlays 103 - 154. You should be able to copy these to a new patched rom. Use Nitro Explorer or NSMBe so as not to corrupt the ROM header.


Thanks, moving the files over to a fresh rom fixed everything. I'll start a Star Road DS thread now, I'll probably have things to post about it quite often.

ray
Posted on 01-02-13 09:12 AM Link | #2662
@Fiachra: Thanks a lot! It finally works :) Now I only need to do the Level objects etc.

____________________
Check out my Patreon Page if you want to support me :)


Pages: 1 2 3 4 5

Main - General SM64DS hacking - Looking into SM64DS fixing collision Thread closed

Page rendered in 0.028 seconds. (2048KB of memory used)
MySQL - queries: 28, rows: 223/223, time: 0.021 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.