Hero Rotration

Ok, one more question for tonight. In my game my hero fixed rotation is false. I have this so the hero can do flips in the air ( as well as rotate when climbing ramps) , but I am running into the issue that sometimes my hero lands upside down. Is their a way that I can make it so the hero always lands right side up?

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    "sometimes my hero lands upside down"

    Why does the hero land upside down ?

  • quinn221quinn221 Member Posts: 280

    Sometimes he lands upside down if he does not finish the rotation or gets cought up on something. Or if the hero descends to fast down a ramp he will flip.

    @Socks said:
    "sometimes my hero lands upside down"

    Why does the hero land upside down ?

  • SocksSocks London, UK.Member Posts: 12,822

    @quinn221 said:
    Sometimes he lands upside down if he does not finish the rotation or gets cought up on something. Or if the hero descends to fast down a ramp he will flip.

    Sounds like a whole bunch of issues here, it would be hard to suggest a solution without knowing anything about how this is coded.

  • pHghostpHghost London, UKMember Posts: 2,342

    If there are specific situations it happens, analyze what causes it (hitting something) and code a solution.

    More info is needed, definitely. Like: does every jump take the same time to finish? Is the rotation speed always the same? Is the character easting hot dogs while spinning around (that usually slows them down, as they are heavier)?

  • SocksSocks London, UK.Member Posts: 12,822

    @pHghost said:
    Is the character easting hot dogs while spinning around (that usually slows them down, as they are heavier)?

    Yep, hot dogs can cause angular drag.

  • quinn221quinn221 Member Posts: 280

    @Socks and @pHghost Guys tanks for responding. I have been playing around with this for most of the night without any luck. I have uploaded a demo file to my dropbox. Could you please take a peek to see if you can help me find a solution. Thanks so much!!

    https://www.dropbox.com/sh/o7wj535p8m99qlw/AABUrqZrUEdLhTBKQB6EzenLa?dl=0

  • imjustmikeimjustmike Member Posts: 450

    @quinn221 said:
    @Socks and @pHghost Guys tanks for responding.

    Really hope that was on purpose.

    A simple solution would be to add a behaviour to rotate the tank when it collides with floor (maybe only if the angle is absurdly out to prevent it triggering when it shouldn't).

    Or destroy the tank if it lands upside down. Seems more realistic, ha.

  • quinn221quinn221 Member Posts: 280

    I was wonder if anyone would catch that!

    I have made a few adjustment and it is almost working. I added some angular drag and
    reset the rotation to 0 when it hits the ground.

    I noticed one more small issue. Everything works fine at first, but afterI I hit the jump button once the tank no longer rotates when climbing the ramps.... Something in the code is contradicting....

    @imjustmike said:

    @quinn221 said:
    @Socks and @pHghost Guys tanks for responding.

    Really hope that was on purpose.

    A simple solution would be to add a behaviour to rotate the tank when it collides with floor (maybe only if the angle is absurdly out to prevent it triggering when it shouldn't).

    Or destroy the tank if it lands upside down. Seems more realistic, ha.

  • imjustmikeimjustmike Member Posts: 450

    That'll be the reset rotation to 0 when it hits the ground

    A quick hack would be to add a boolean self attribute called self.is-flying. When it starts to fly, change it to true. Put the reset to 0 rotation in a collide with ground AND fly is true. Make sure you turn it to false when it lands.

    That way it should only trigger when the tank was flying, not just rolling along minding its own business.

Sign In or Register to comment.