Need help making an actor non-collidable when player touches it.

pepemorenopepemoreno Member Posts: 13
edited August 2012 in Working with GS (Mac)
I'm working on a game where essentially there are a lot of items on a conveyor belt. I want them to be collidable so the system can get "backed up" so to speak. When the player touches an item, I want it to seem like they are picking it up, and therefor make it free of colliding with something on the lower "layer". All the rules I have tried make the item you pick up non collidable, but since the ones on the belt still are, the net result is I did nothing.

I hope that wasn't too confusing. Can anyone help point me in a direction?

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited August 2012
    You can't change the physics engine parameters when code is active in gamesalad. You would need to do a work around with another type of attribute.
  • ironDanironDan Member Posts: 148
    You can make a self attribute (boolean) call it collide and make a rule that says when self.collide is false and add a collide with whatever it is you want to collide with rule inside that rule. Then in the rule you have to let the game know when you are grabbing that item and no longer want it to collide add another item make a change attribute and set it to change self.collide to true. Just one of many ways to accomplish what you want.
  • pepemorenopepemoreno Member Posts: 13
    edited August 2012
    @ironDan
    I get what you are saying, but my problem really comes from having multiples of the same actor that I still want to collide with each other, just not the one the player is touching.

    I tried doing it with a global variable as well, and while that accomplished what I wanted, the other actors on the scene then would not collide with each other.

    I had an idea where I would have to spawn a new actor in place of the one you are touching, but I want it to be set down when touch is released, but with the second actor I needed to tap it a second time before it would be set down.
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    You have a box on the conveyer belt. Give it a boolean for "grabbed" and set it to false. Make a rule that says 'If self.grabbed is false collide with actor tag 'boxes'' (give all the conveyer belt items the same tag. Then a rule that says 'if touch is pressed change self.grabbed to true, other change self.grabbed to false'. This way, when you let go, it will collide with the other actors again.

    If you use a global boolean all the actors would stop colliding when one is grabbed because they all adhere to the on global attribute, however, if you make the attribute for the actor only, no matter how many are on the scene, the attribute would only change in the one being grabbed. Like @ironDan said, just explained a bit differently.
  • rhinokeyrhinokey Member Posts: 158
    the booleans work independant of other instances of the same actor @pepemoreno if
    you have an actor made where on touch blah blah, and then "otherwise: collide with conveyor. then only the one you touch will have its collision not activated.

    also i was under the impresion that anytime an object is constrained to touch it overides that objects collision by default. i remember a @tshirtbooth tute where he shows how to set contraints to keep a touch to move box inside the scene.
  • pepemorenopepemoreno Member Posts: 13
    I can turn off the collision on the actor that is being touched. The problem is the items still on the conveyor belt will collide with it because their attribute is not changing. (Note that they are different instances of the same actor). Thank you everyone for your help, but I found a method that works with just replacing the grabbed actor. Unless someone has a better way of making this work
Sign In or Register to comment.