Slope limit?

Blitz3D Forums/Blitz3D Beginners Area/Slope limit?

Guy Fawkes(Posted 2013) [#1]
Hi! =) Is there any 3D function I can use that will prevent my player from climbing up at a certain X-Angle of a 3D terrain's slope, without it causing problems with little slopes in the terrain? (Hills, etc)?

Thank You!


RemiD(Posted 2013) [#2]
Yes, you can use linepick or collisions and check what is the normal of the picked or collided triangle.

If i remember correctly, each normal parameter can have a value from -1.0 to 1.0 which represents the angle on one axis.

I am not sure, but i think that a NY# higher than 0.5 means that the slope is more than 45° (90/2 = 45 and 1.0/2 = 0.5 )


ando(Posted 2013) [#3]
Hi Thundros, if you are the same person that asked me something on another forum reguarding my code, then my answer is yes. :)


Guy Fawkes(Posted 2013) [#4]
Hi, Ando! :) Long time, no see. But yea, I am. Thanks alot, Ando! :)


Guy Fawkes(Posted 2013) [#5]
Is this how you would do it?



Thank You!


_PJ_(Posted 2013) [#6]
If you weren't concerned with memory usage, didn't care for any other objects and steepness of slopes and/or wanted to check for slopes continuously every frame regardless, and were using a global handle for "player" to a sprite - then yeah, that is kinda how I suppose it may be done.
For some reason you are performing the check in front of the player entity, not beneath their feet. Is this intended?
The range value you use is rather odd choice, is your player 1000 units high? If you plan to include a facility for Jumping/Falling this may cause problems...

Alternatively, One might want to be more specific regarding the particular frequency of checks and maybe allow for the checks to be made on any object: