Angle Tweening

This forum is currently in read-only mode.
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • If I wanted to set the angle between two objects gradually, how could I do that?

    For example, I want my rocket to turn towards the cursor at a rate of 2 degrees per frame. How could I go about achieving this effect? (rather than the rocket simply pointing to the cursor all the time)

    Some sort of function to get the angle between two objects would be handy (if there isn't already one there, I believe sin/cos/tan could possibly be used however I was always bad at trigonometry and the like D: )

  • You do simply like this:

    -Create Sprite object

    -Create Event "Always"

    -Action "Sprite: Rotate 2 Degrees toward (MouseX,MouseY)"

    If you want rocket to be slower change Always to Every 0.5s or something like that

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yep, you can use "Rotate towards position" or "Rotate towards another object." As Doppel pointed out there's a "Rotation amount" setting for both of those.

    Alternatively, you could do something like:

    +Sprite Angle Less than 180
      -Sprite: Rotate 2 degrees clockwise
    [/code:27t7u81m]
    
    "Set angle" makes the object jump immediately to whatever angle you pick, "Rotate (whatever)" sets the angle gradually.
  • Thanks for pointing that out, I feel kind of dumb for missing it.

    Maybe I should sleep sometime, I hear it's beneficial.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)