### runSurfaceAngle Over 89 Breaks Gravity

Expanding and utilizing the engine via C++.

#### runSurfaceAngle Over 89 Breaks Gravity

Steve_Yorkshire
Posts: 248
Joined: Tue Feb 03, 2015 10:30 pm

Setting PlayerData runSurfaceAngle to 90 or more in the Player's datablock means that the "Fall" flag never set, so the player can only go upwards or walks in the air.

This is actually logical, as the test for player contact is directly vertical to the playerObject and >89 degrees is horizontal.

So if the player runs up a steep slope and then steps off into thin air, they stay hovering and can never move back downwards.

Obviously this should simply be avoided by using sensible values in the datablock, but just incase for those of us who might make a mistake (*cough* it only took me days to work out what the issue which I was having was ) it might be an idea to add a little safety check to the code.

Engine/source/T3D/Player.ccp
bool PlayerData::preload(bool server, String &errorStr)
{
return false;
//...

if (runSurfaceAngle > 89)//yorks safety first
{
runSurfaceAngle = 89;
Con::warnf(ConsoleLogEntry::General, "PlayerData::preload: runSurfaceAngle exceeds 90 degrees. Resetting to 89 degrees.");
}//yorks end safety first

if (minJumpEnergy < jumpEnergyDrain)
minJumpEnergy = jumpEnergyDrain;

// Jetting
//...

#### Re: runSurfaceAngle Over 89 Breaks Gravity

Jason Campbell
Posts: 255
Joined: Fri Feb 13, 2015 2:51 am

Thanks Steve. Though I doubt this will affect me, it's good to know. Who now's maybe if someone was trying to implement parkour or the scene at the end of Doctor Strange.

#### Who is online

Users browsing this forum: Bing [Bot] and 2 guests