Player's drag to control orbit around a point

justinodunnjustinodunn Member, PRO Posts: 226

Hi, so I'd like to create an actor that orbits around a point based on the player's drag motion. So if the player drags and holds the actor towards the right side, the actor orbits to that direction around the point, however still following that "fixed" path around the point. Any ideas?

Comments

  • justinodunnjustinodunn Member, PRO Posts: 226

    Like this:

    You drag the turtle around the circle, and no matter where your mouse goes, as long as it's greater than or less than its current x position, it will continue to either direction based on the player's drag movement.

  • justinodunnjustinodunn Member, PRO Posts: 226
    edited December 2016

    Here is an idea I have:

    • Use vector to find angle between mouse position and centre object

    • If angle between mouse and centre is greater than angle between rotating object and centre, then activate orbit

    • If angle between mouse and centre is less than angle between rotating object and centre, then activate orbit in opposite direction

    Would this work?

    EDIT: I'm using the orbit formula from this video

    Meaning that the orbit would only happen at a certain speed when triggered, rather than orbiting based on the player's drag movement (speed).

Sign In or Register to comment.