Glue actor to another actor?

I've been attempting to glue an actor to a rotating ball actor for a long time. Nothing seems to work, i even tried constraining the rotation attribute to both actors and the ball didn't even rotate? Is there an actual method to do what I'm trying to accomplish? Essentially i want to pin down an actor on to another actor so one actor is static and one is dynamic. So for example like a spinning ball that constantly spins and when i click on the mouse the the other actor collides with the rotating ball and "sticks to the ball" Any help is appreciated! Please let me know if you need further elaboration as to what i'm trying to accomplish because it seems no one has answered this question fully on the forums so it would be beneficial for everyone.

Comments

  • izzydoghamizzydogham Member Posts: 24
    Not quite! I want the actor to sync with the first actor's rotation as soon as they collide!
  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    edited July 2013
    Create an real attrubute and call it Rotation.

    When Overlaps or Collides:

    Constrain attribute Game.Rotation to self.rotation

    Then in the one to constrain:
    Constrain attribute self.rotation to Game.Rotation
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    One way I have made this a bit smoother is by calling an attribute lets say 'Gravity'.

    So when your actor(B) is not colliding, the attribute Gravity is set to 1.

    Then you have a rule that contains all the movement for the actor(B) and only works when at attribute Gravity is set to 1.

    When the actor(B) collides with the actor(A) it needs to stick to - you change the attribute Gravity to 0.

    This means the actor(B) is now static and not getting the movement rule.

    You can back that up by using attributes to then stop it or slow it down.

    You then state in your rule that you constrain the self.Position.X and self.Position.Y and self.Rotation of actor(B) to match the other actor(A) who controls this actor.

    You need to have attributes for actor(A) constrained to each bit of data you need - sounds like self.Position.X, self.Position.Y, self.Rotation, is what you need to constrain to actorX, actorY, actorRotate. All real attributes.

    I hope this is clear enough and helps!

    It has smoothed that problem out for me.
  • izzydoghamizzydogham Member Posts: 24
    send me a project file matuara?
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    Here you go bud, just a quick hack version with what I said above - hope this helps - obviously you will need to get rid of all of the copyrighted 'Call of Duty Duty' artwork (joke ;).

    image

    https://us.v-cdn.net/5017598/uploads/FileUpload/a7/f593e5194687beb984dcce6eb60ee4.zip
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I don't recommend using glue on your GameSalad projects. It makes a huge mess and will likely destroy you phone of computer. :D

    Sounds to me like what you your wanting to do is kinda like the game mechanic in A Long Way Home by @jonmulchay If so Your gonna need a math wiz to help you out with some complicated Trig Expressions.

    Good Luck

    @matarua thats hilarious
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    @tenrdrmer - you don't know how many times I have watched that. Mad props go to @anatomyofdreams for doing it.
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    lol, in the demo I did, if you grab a bunch of those blue block ActorB actors and throw them on stage they speed up massively and still stick and rotate as told. So it's working you just have to adapt it to your game and needs.
Sign In or Register to comment.