Smooth Character turning / Natürlich Charakterdrehung

  • #30, by vectracocoTuesday, 30. September 2014, 14:00 10 years ago
    I just had thought something simple to somewhat soften the sharp turn of the character in standing as well said AFRlme. But it seems that there are good ideas and desire to achieve perfection.
    Welcome are ideas. Good job Simons.

    Newbie

    19 Posts


  • #31, by vectracocoTuesday, 30. September 2014, 14:06 10 years ago
    For example: Broken age is not pixel art, and I think that it also has one or two frames of rotation that soften a little. Had something I thought not complicating too.

    Newbie

    19 Posts

  • #32, by SimonSTuesday, 30. September 2014, 14:15 10 years ago
    Broken has no real turning animations. They just cycle the animations, happens in 3 frames or such, the change of the head has also a kind wobble after it has turned. But all that is done with sprite parts.

    Thread Captain

    1581 Posts

  • #33, by afrlmeTuesday, 30. September 2014, 15:04 10 years ago
    I was struggling to see anything that resembled rotation function in the source code files. I did see code for calculating the current direction to next direction based on way system though I think.

    Imperator

    7278 Posts

  • #34, by SimonSTuesday, 30. September 2014, 15:14 10 years ago
    That's because it isn't necessary, you just cache the old direction and if the character has changed the direction, you have both directions and can do what is necessary.

    Thread Captain

    1581 Posts

  • #35, by Lord7evenTuesday, 30. September 2014, 17:20 10 years ago
    I can't get the script to work but it's because I'm too stupid and unskilled with Visionaire and scripts. I guess I'll have to read some tutorials or documentary first. ;-)

    Newbie

    40 Posts

  • #36, by SimonSWednesday, 01. October 2014, 11:06 10 years ago
    The script isn't really working good as far as I heard the reactions. To get it running you need an animation "character_turn" for your character, that plays a 360 turn. Then you need to change this line:
    smt_animation = {Rufus = {135, 150, 180, 225, 270, 315, 0, 25, 45, 90, 110}}
    Rufus needs to be your character name, and the for each frame the angle of the frame, 135 is up left btw, light it shows using the direction tool at the animation settings.

    Thread Captain

    1581 Posts

  • #37, by Lord7evenWednesday, 01. October 2014, 18:01 10 years ago
    Well I forgot to change the name Rufus to my heros name, the rest I've done allready and I guess I understand whats going on in the script. I'll try it again, thanks for your help!

    EDIT: Now it works! It does something weird sometimes but the basic is working. Let's see if I can improve it a little.

    Newbie

    40 Posts

  • #38, by vectracocoThursday, 02. October 2014, 11:26 10 years ago
    I've managed to escape a little work (not could take anymore) I have tested the script giro Simons and I think that it can work very well.
    It would only be missing Polish it a little. But the base is very good.wink

    Newbie

    19 Posts

  • #39, by Lord7evenFriday, 03. October 2014, 17:14 10 years ago
    I'm testing the script for a few hours now. I guess there is a little typo in Simons version. "bestspos = i" instead of "bestpos = i" but that’s not the main issue. Don't get me wrong, the script is pretty fine but I guess there is a problem with play animations in opposite directions. Somehow it does something weird. The script calculates the first and last frame of the character turn animation. (bestspos and bestlpos). So it should at least play 2 frames before walking into a new direction. With "play in opposite direction" it sometimes plays only 1 frame. Simons script changes the first and last frame when the animation should be played in opposite direction. I don't know if this is the right solution but without the change of first and last frame it does the same weird thing. I'll try to set a second animation for the anti-clockwise turn so Visionaire don't have to play anything in opposite direction.

    The second problem is the calculation of clockwise and anti clockwise turn. Simons script does that by checking whether the first frame has a larger index number as the last frame or not. I changed the angles of the frames in the "character_turn" animation so the largest number is the first on in the table: "smt_animation = {Hero = {270, 180, 90, 0}}" because the calculation of which frame is the best, starts with 360 and loops through the smt_animation table and at the end we will have the smallest difference between the actual direction of the character and the available direction-frame of the "character_turn" animation - ergo the correct start and end frame which should be played.
    The problem here is now that the script "breaks" if we have a startframe with index 1 (270°) and an endframe with index 4 (0° or maybe 45°), the condition "firstFrame < lastFrame" is true so it plays the animation normal (clockwise turn) which is wrong. I'm trying to find a solution for this.

    P.S. Maybe I'm totally wrong, so please correct me. ;-)

    Newbie

    40 Posts

  • #40, by afrlmeFriday, 03. October 2014, 18:13 10 years ago
    The math equations in the script are not perfect, hence it doesn't always take you the shortest way from current direction to the next direction. I don't think there were any typos in his script as I got it working.

    I have spent the past 2 days working on equations to correctly get the shortest rotation route from current direction to target direction. I am not willing to share it yet as I've not gotten round to writing the part of the script that handles character states or destination actions. Maybe I will get round to it later this week as my head is still hurting from all the different math equations & methods I tried using. & FYI I'm not right good at mathematics, as it takes me about 10 times longer than average person to calculate simple math stuff like multiplications & divide etc. Simple stuff. confuse

    Imperator

    7278 Posts