edited August 2021 in ORK Support
Hey Gil,

I want to make something similar to the Throwing a Fireball howto on here but in 2d.

I have set up the event but dont see a way to rotate the sprite (z-axis) to the angle it will have to travel.
I also did not find a getAngle node or anything like that.

How would i go about making the fireball sprite face the correct direction? (The actor is not rotated as he stands on a square grid where the sprites just change for animation)

Thanks in advance!
Post edited by dendiee on
  • For rotating it to a target, use a Rotate To node, it also has options to ignore defined axes - for only rotating on Z, ignore X and Y axes.

    For setting the rotation, use a Change Rotation node, enable Set Rotation and e.g. use the Game Object Rotation value type to copy to the user actor's rotation.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Aha! But see that is the problem :) on topdown games the actor doesnt really rotate so changing the projectile to the rotation of the actor's rotation is not correct.

    The problem here is finding the rotation value
  • Well, if the actor isn't rotating, how do you determine in which direction to shoot at?

    E.g. if you want to shot at the cursor position, you can use a Raycast To Variable node (Screen ray origin and enabling Use Mouse Position) and use the stored Vector3 variable in a Rotate To node as target position.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • The direction was based on location on grid.

    I decided to just write a custom script, thanks for thinking with me though!
  • If you had that position/game object, you could have just used a Rotate To node :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.