Game Development Community

Player bouncing off steep terrain

by Ian Curtis · in Torque Game Engine Advanced · 08/16/2009 (11:53 am) · 2 replies

Hi guys and gals,

In stock TGEA/AFX 1.8.1 when a player hits a steep terrain it will slide down.
Taken that runSurfaceAngle in PlayerData datablock are set to say 45, and my player is in the air with horizontal velocity, and bumps into a steep terrain (angled at over 45 deg) it will slide down it, which is expected.

Is there a simple way of changing this so that the player bounces off the steep terrain with opposite horizontal velocity rather than just slides down?
I'm aware that I may have to change code in player.cpp, but before I start diving in I just wondered if there was any simpler way I hadn't noticed.

Any advice welcome, thanks.

About the author

Also known as Woldoc on the MMOKIT forums

Recent Threads

  • Console Transparency

  • #1
    08/16/2009 (8:41 pm)
    The PlayerData::onCollision callback should be fired when your player hits the terrain. Override this method in scripts to do something like apply an impulse in the opposite direction (if you hit terrain, not other objects).
    #2
    08/17/2009 (3:59 am)
    thx for the reply Daniel, I tried that, but onCollision doesn't trigger for terrain collisions, I've added a bit of code for it now, and added the code as a resource.

    http://www.garagegames.com/community/resources/view/18113

    Thanks