Jump to content

runSurfaceAngle Over 89 Breaks Gravity


Recommended Posts

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 :oops: ) it might be an idea to add a little safety check to the code.


bool PlayerData::preload(bool server, String &errorStr)
   if(!Parent::preload(server, 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
   runSurfaceCos = mCos(mDegToRad(runSurfaceAngle));
   jumpSurfaceCos = mCos(mDegToRad(jumpSurfaceAngle));
   if (minJumpEnergy < jumpEnergyDrain)
      minJumpEnergy = jumpEnergyDrain;   
   // Jetting
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...