Author Topic: Mesh falls through floor?  (Read 2416 times)

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Mesh falls through floor?
« on: March 22, 2013, 02:13:06 PM »
Hey :)


Sorry to have to post soo many threads haha xD


I'm having a slight problem with my Dantomkia shell mesh-


It keeps falling through the floor...





(First image)


The collision shows that it's a solid object (2nd image)


Anyone know how to fix this problem?


Also, while i'm here, anyone know why it gets darker when it gets to that kind of angle? (3rd image)


If anyone wants to have a look at it then feel free :P


Also I know there's some face mesh problems (why the top doesn't show up) but i'm trying to sort one problem out at a time at the moment haha xD


https://gametechmods.com/uploads/files/dantomkia2.rar


Thanks guys :)


-Wham
Damn I should probably put something fancy in this bit huh?

Offline RedSawn

  • aka RedlineM203
  • *
  • Posts: 1922
  • Rep: 4
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: Mesh falls through floor?
« Reply #1 on: March 22, 2013, 06:40:50 PM »
I can replicate this problem with a 90 degree axle and an EMERGENCY wedge. I believe if an object starts in the ground unexpectedly it defaults as being able to pass through it. (Or not colliding with anything, I haven't tested the effects of this for a while)

Haven't done GMF editing like that but perhaps you need to change the mesh's ambience HEX colour. Have a feeling it exists, just have a hunch.
« Last Edit: March 22, 2013, 06:47:24 PM by RedlineM203 »




Offline 090901

  • alcoholic in denial
  • *
  • Posts: 7006
  • Rep: 22
  • :mrgreen:
  • Awards Donated money for site hosting 2019 GTMCS2 Divison Winner GTMCS Division Winner
    • View Profile
    • Awards
Re: Mesh falls through floor?
« Reply #2 on: March 22, 2013, 07:22:58 PM »
Most the time this only occurs in the Test Arena it seems.

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Re: Mesh falls through floor?
« Reply #3 on: March 22, 2013, 07:31:27 PM »
No it happens in all arenas :/ It's like the collision isn't even there - even the opponent robots pass through it :S It's showing that the collision is there, but it just doesn't seem to recognise it :/
Damn I should probably put something fancy in this bit huh?

Offline Badnik96

  • tired of your shit
  • *
  • Posts: 17527
  • Rep: 3
  • Awards BOTM Winner
    • View Profile
    • Awards
Re: Mesh falls through floor?
« Reply #4 on: March 22, 2013, 09:47:19 PM »
Maybe you're using the wrong type of collision? IIRC there are like 3 or so types of collision, maybe someone more experienced can prove me wrong or something

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Re: Mesh falls through floor?
« Reply #5 on: March 23, 2013, 10:44:48 AM »
Not too sure about that :S
It should be the same type as the ramplate collision :S
Damn I should probably put something fancy in this bit huh?

Offline Trovaner

  • *
  • Posts: 1222
  • Rep: 32
    • View Profile
    • Awards
Re: Mesh falls through floor?
« Reply #6 on: March 23, 2013, 07:02:10 PM »
I haven't had enough time to find/fix all the errors yet but it has to do with the face normals.

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Re: Mesh falls through floor?
« Reply #7 on: March 23, 2013, 07:28:21 PM »
Ahh ok :S Thank you for looking! :)
Damn I should probably put something fancy in this bit huh?

Offline Trovaner

  • *
  • Posts: 1222
  • Rep: 32
    • View Profile
    • Awards
Re: Mesh falls through floor?
« Reply #8 on: March 25, 2013, 07:01:34 PM »
I corrected the face normals but some of them need to be flipped around still (by multiplying the three values after the index by -1). It seems to be going through the ground less now but if flipping some of the face normals doesn't completely fix your problem then you may need to modify the vertex normals. You can tell if the face normal needs to be flipped by the darkness of the skin when the light is pointed right at it (just rotate the component preview window until that side of your chassis lights up and if the component doesn't do the same then it is backwards). Here is the current version of the GMF (compiled and decompiled).

You had 133 faces in your mesh so there needed to be 133 face normals. You also needed to set them to be orthogonal to the face's surface (orthogonal is a term used in Calc III to describe a vector that is perpendicular to a surface in 3D space). For those of you who haven't taken Calc III, calculating the face normal is actually a relatively simple task. It goes something like this:

Code: (Pseudocode) [Select]
#Each face is made up of three points in space. We'll refer to these as A, B, and C.
#Each point in space has an x, y, and z value respectively. We'll tag the x, y, and z onto the point to specify which one we are referring to. For example, the x coordinate of A is Ax.

# Get the vectors for two edges (we'll use the lines from A to B and B to C)
Px = Ax-Bx
Py = Ay-By
Pz = Az-Bz

Qx = Bx-Cx
Qy = By-Cy
Qz = Bz-Cz

# Compute cross product of vector P and Q
Nx = Py*Qz - Pz*Qy
Ny = Pz*Qx - Px*Qz
Nz = Px*Qy - Py*Qx

Vertex normals can be calculated by taking the average of all the faces joined by each vertex. They are currently using the same as the face vector that they are associated with. It isn't always necessary to calculate these so I didn't do them (it is important that the face normals are correct before attempting to calculate these).

On a side note, I noticed that you set the passthru property inside of the Component.txt to "collision" but that is not an object within the Component.gmf. You probably want to set it to "ramplate" (the name of your current mesh).

Edit: As you may have already guessed, your lighting issue is related to the normals as well.

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Re: Mesh falls through floor?
« Reply #9 on: March 30, 2013, 10:44:52 AM »
Thanks Trov, however it still doesnt appear to be working :/
Just had a slight idea - the way I meshed it was by mainly putting planes together, and IIRC, if a mesh is too thin, it seems to fall through the floor. It wouldnt be a problem like that would it? :S
Damn I should probably put something fancy in this bit huh?