Rotate Object Back After Touch Rotate

Discussion in 'How Can I...?' started by MarcG, May 10, 2020.

Tags:
  1. MarcG

    MarcG Boxer

    Joined:
    May 10, 2020
    Messages:
    35
    Likes Received:
    9
    Looking at the 'Fly' example, Touch Rotate is used to make the player's ship bank on the Z axis as you move left and right.

    I've added keyboard control and emulated similar using Keyboard Button nodes with a Rotate to alter the Z-axis accordingly.

    What I'd like to do, when the touch or the keypress is released, is rotate the ship back to horizontal, but can't see a way to do that.

    As far as I can tell the Rotate node has no concept of setting to a position of rotation, just a speed to rotate.

    Any help appreciated.
     
  2. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Have you tried to reset? perhaps use a delay/timer to reset its position?
     
  3. MarcG

    MarcG Boxer

    Joined:
    May 10, 2020
    Messages:
    35
    Likes Received:
    9
    Thanks for the reply.

    I can't see how I can initiate a reset of position?

    I'm not sure it's really the answer either, it would be an abrupt jump which isn't really desirable.
     
  4. MarcG

    MarcG Boxer

    Joined:
    May 10, 2020
    Messages:
    35
    Likes Received:
    9
    Anyone?
     
  5. 5petersonzachary

    5petersonzachary Serious Boxer

    Joined:
    Jan 23, 2016
    Messages:
    569
    Likes Received:
    169
    On the release output of the keyboard node you could use a rotation animation node to reset it back to zero. Although im not sure if you should check Is Delta or not but you could try it both ways.
     
  6. MarcG

    MarcG Boxer

    Joined:
    May 10, 2020
    Messages:
    35
    Likes Received:
    9
    You are a superstar!

    Works a treat (without 'Is Delta').

    Thank you.
     

Share This Page