Floating actors
robz
Member Posts: 50
Please help, I have a demo game with buttons for up, down, left and right. These buttons are used to move squares in my game (when selected). The squares stop when colliding with surrounding walls and other squares. However If I select a square and move it into another square that is on a wall they collide and all is ok fo a second but then they start to float.
I have tried changing the objects moveable but its not working.
So my question is how do you lock / unlock an actor (position wise) at will or on collision
Thanks
I have tried changing the objects moveable but its not working.
So my question is how do you lock / unlock an actor (position wise) at will or on collision
Thanks
Comments
PS thank you, i now have more options to play with; so back to the fun.
Setting linear x/y to 0 and changing density work in part but if you continue colliding with these actors they start to move (very slow) but still move. I have even attempted to track the actors X any Y in integers and constrain self.position.X and self.posiyion.Y to these values, and nothing changes.
just an idea
I have considered that, however i will have upto 15 actors that will need this. I also want to be able to "click to reactivate" these actors at any point so they can be moved again. Thats a lot of spawning.
after much experimentation i have fixed my floating actor problem. If anyone else has this problem this is how i did it
give your actor 2 real attributes, i named them LockedX and LockedY. When you want to stop your actor from moving (completely) set the new attributes to the actors Position X and Y then immediately constrain the actors Position X and Y ( or (X or Y)) to the values in the attributes
e.g
self.LockedX = self.PositionX
self.LockedY = self.PositionY
constrain attribute self.PositionX = self.LockedX
self.PositionY = self.LockedY
hope this helps anyone with this problem