GameSalad

Constrain actor to circle

Like the title says, we need to keep an actor constrained so that it maintains a constant distance from another actor but can still move around it on a circular rail while still responding to collisions. We attempted to offset the center off mass to be in the center to no avail, and the magnitude functions don't seem to work as intended for this (it could just be faulty logic on our end).

Going deeper into the details, what we have is a central actor that is constrained to your finger, and another that hangs below it, with another actor of fixed dimensions between the two. The hanging actor needs to maintain a constant distance from the central actor so there is no gap between the connecting and hanging actor, and if it were to be swung around it would create a perfect circle. We can give more specific details if necessary, and complexity isn't a issue as long as the logic that runs it is rock solid.

Ideas?

Comments

  • NNterprisesNNterprises Posts: 387Member, PRO

    ****THIS IS NOT GUARANTEED TO WORK AND WILL NEED SOME TWEAKING:

    You'd have to use the distance formula...
    http://www.mathwarehouse.com/algebra/distance_formula/index.php

    Make an attribute called DISTANCE then use the distance formula where x1= mouse. position.x, and y1 = mouse.position.y.
    X2 is self.position.x on the actor that circles it, and y2 is self.position.y.

    Do a constant loop saying change DISTANCE to Distance formula with your above attributes in it^.

    Actually I would need a lot of time to think and play with it.... but there's a start for you

  • RThurmanRThurman Posts: 2,793Member, Sous Chef, PRO

    Sounds like you want a pendulum.

  • Look Creative, L.L.CLook Creative, L.L.C Posts: 5Member, PRO

    Yes, exactly like a pendulum!

    @NNterprises the distance formula seems promising but like you said would need a lot of tweaking to get it running. It'll be difficult to adapt that to constrain the actor, and it'll probably be just as difficult making it respond to collisions, but its a start.

  • NNterprisesNNterprises Posts: 387Member, PRO

    I think I remember a pendulum template or thread. Search in Google for "gamesalad pendulum"

  • SocksSocks London, UK.Posts: 12,821Member

    @Look Creative, L.L.C said:
    Yes, exactly like a pendulum!

    How would it swing ?

Sign In or Register to comment.