Best way to walk on a mesh?

Blitz3D Forums/Blitz3D Programming/Best way to walk on a mesh?

Swifty(Posted 2009) [#1]
I`m currently coding the players avatar to walk on an uneven mesh that I am using for terrain, but I`m having problems getting it to "stick" to the ground. It is floating a little above the ground ,and sometimes drops through when going uphill.
I am using linepick to detect the mesh below the avatar. Would using entitycollided be better for this?

What would be the best way to code walking on a mesh?


Adam Novagen(Posted 2009) [#2]
Hm... Have you examined the "driver.bb" car demo? It's in the "mak" folder in the B3D Samples. It uses four spheres to simulate wheels & utilizes terrain-based ground-oriented physics... You might be able to extract something from it.


Vorderman(Posted 2009) [#3]
If you're using linepick and dropping through the floor, try starting the linepick higher up and project it downwards a bit further - for example start it at the character's waist level and linepick down by just slightly more than the distance from the waist to the feet.


jfk EO-11110(Posted 2009) [#4]
I'd suggest to use Sphere vs polygon collision for the character vs the ground/enviroment. Using both parameters allow ellipsoid collision. Now when you combine this with the linepick (and only apply gravity when no ground was picked) then you can define the ground angle the Chars starts sliding, but prevent sliding on almost flat surfaces, actually quiet natural. Something that is kind of tricky to achieve with Collision only, but very useful for the gameplay.

At least today I'd do it this way.


RifRaf(Posted 2009) [#5]
what did you come up with swifty?

im tinkering with a similar issue with a networked game. I cant seem to get it just right. The player(toy tank in this case) aligns to the slopes (most are 45 degree ramps) and when it reaches the top, and crosses to a new flat platform theres a shutter, as well as a shutter when going down slopes. At the moment, im doing collision checks for the alignment to vector, and linepicking to check if the tank is in the air, applying gravity if it is. Im not happy with my results so far.


Stevie G(Posted 2009) [#6]
@ Rifraf, add 4 collision pivots at each of the lower corners of the tank and align to vector on both the x and z axis' for smoother alignment. For an example see the "3d Samples / Mac / driver" demo.

Stevie


RifRaf(Posted 2009) [#7]
I had considered that but the toy tanks arent really that big. By the
time the main pivot crosses the threshhold .. corner pivots would be just
about over it as well :)

I think its an entityradius versus linepick length issue though, its not really a smooth alignment thing.. Ill post code later if i cant get it to work right.

Thanks

edit: Got it sorted. I was using a linepick to check the ground, I just spread it out on the Z axi and made two linepicks. One just in front of center and just in back of. Works great now.