collide question

mwchambmwchamb Member Posts: 4
edited May 2012 in Working with GS (Mac)
If I have an object inside of walls that bounces off the walls and I have another object that I want to use to navigate by that object how do I make it so that the when the objects hits the other object it doesnt move?

Answers

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Change attribute self.motion linear vel. X to 0
    Change attribute self.motion linear vel. Y to 0
    Change attribute self.motion ang vel. to 0

    That should do it...
  • mwchambmwchamb Member Posts: 4
    Hmm. I wasn't sure which object to change that to but I tried it on both and still no success. There is a block that moves left to right at x speed and bounces off the walls on the left and right side. I want to be able to drag an object past the bouncing blocks without knocking the blocks off into the rest of the game. I also want to the object to recognize the blocks are there but I want no effect on the blocks. If that helps?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2012
    The draggable object is only going to affect the blocks if you've created rules to make it do so. The default behavior in GameSalad is that actors do not affect each other. Have you been using Collide behaviors?

    To have the object recognize that the blocks are there, have a Rule that says When actor overlaps or collides with BlockActor ... do something (e.g change an attribute).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • mwchambmwchamb Member Posts: 4
    Ahh...so I need to give the blocks a unique attribute instead of a generic bouncable object attribute if I want this object to avoid it? That makes logical sense.
  • mwchambmwchamb Member Posts: 4
    And for the second part of the answer, what attribute would equate to just knowing it's there. Like moving around the actor to get to another position on the board? In other words, if I set a rule that if it overlaps with the blocks what attribute is going to keep the object from passing through the block and result in having to navigate around the block? Thank you in advance!
  • mwchambmwchamb Member Posts: 4
    by attribute I meant behavior
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If you want actors to be prevented from overlapping, use the the collide behavior with the actor's physics-->restitution value set to 0. If you want actors to actually bounce off of each other, use the collide behavior with the actor's restitution value set to greater than 0. If you don't want them to freely overlap, don't use a collide behavior.

    The "When actor overlaps or collides with [another actor]" rule allows you to change an attribute such as game.TouchingBlock (boolean). You could have it change to true when overlapping and false when not (using the Otherwise section).

    If you're trying to have actors touch but not bump each other, make sure their restitution is set to 0 and also make sure that their "Fixed Rotation" checkbox is checked. Finally, if they don't have to move with a Move behavior, also uncheck the "Movable" checkbox.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.