Change to collidable size

TangleTangle Member Posts: 10
edited November -1 in Working with GS (Mac)
G'day,

Changing the size attributes of an actor does not appear to change the size of it's collision shape. Does anyone know a way to change the size of the collision shape?

What I am trying to do is a selection box. Spawn an actor at a mouse location, contain it's size to the difference between that position the ongoing mouse position and anything that collides with it will be selected.

An alternative might be to spawn a new actor at the correct size on mouse release, but I still need to be able to specify the collidable size of that actor.

Thanks for any help
Tangle.

Comments

  • dre38wdre38w Member Posts: 79
    What exactly do you mean by ongoing mouse position? But if you just do Change Attribute self.size to whatever it'll keep the collision with the new size. At least that's the way I know how to do it.
  • TangleTangle Member Posts: 10
    I want to click and drag to form a box of variable size. However I also want the collision size to vary with the dragging. It seems that if I change the size of an actor, its collision shape stays the original size that the actor was spawned as.
  • dre38wdre38w Member Posts: 79
    Okay. That'll deal with magnitude the position of the actual box and the position of the mouse. You would do something like this.

    Rule
    When Touch is Pressed
    --Constrain Attribute
    self.Width to magnitude(self.position.X - devices.mouse.position.X, self.position.Y - devices.mouse.position.Y)

    Do the same for the Height and place it within the same Rule and it should work.

    By the way. Sorry I didn't reply earlier. I've been very busy. haha
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Unfortunately there is a bug right now where while the size of an actor is changing the collisions are not detected.

    They do know about it and definitely are trying to fix it.

    Also in your case constrains generally override collisions so that may be affecting things too. That however is not a bug.
  • dre38wdre38w Member Posts: 79
    Didn't even check that part. Sorry bout that. So will they ever allow collision when you use Constrain?
  • dre38wdre38w Member Posts: 79
    Well that was strange. I placed a collide on an actor and set it so when the other actor grows they would collide. And they didn't. Yet I then put a force on the one actor, accelerate to be specific, had that fall onto the growing actor and it worked just fine. Collided and what not. And I'm still using magnitude and that constrain attribute. Now why is it that it collided then and not before?
  • dre38wdre38w Member Posts: 79
    hahaha Wow. I think I know why it wasn't colliding without the force because it's colliding now. It's because I was probably having it collide with itself. I didn't name them so I probably got confused between the two. Buuuuut anywho it collides fine now. Sorry for the multiple posts. I hope any of this helped Tangle.
Sign In or Register to comment.