Walls Not Solid? Dragged Character Passes Through Wall Actors
rainwaterstudios
Member Posts: 198
I'm experiencing a problem with collisions when dragging an actor around; the actor will stutter through the walls or just move through them.
I have collide behaviors in both the dragged actor and the wall actor, and the dragged actor is setup to interpolate its X and Y to the mouses X and Y every .06 seconds. Any ideas on what is causing this or if there is a way to set up this functionality differently?
Comments
Interpolate is not part of the physics system (it simply changes one set of numbers to another), actors need to be within the physics system to detect a collision.
Okay, I understand that now; I changed the timer to 'change attribute' for X and Y every .03 seconds, but am still having the stuttering and moving through walls problem...
When Mouse Button is Down
--Constrain Linear velocity X to 5
*
(Mouse.X -self.X)--Constrain Linear velocity Y to 5
*
(Mouse.Y-self.Y)Otherwise
--Change Linear velocity X to 0
--Change Linear velocity Y to 0
. . . . . . .
And here's the same thing if you want to include Rotation:
When Mouse Button is Down
--Constrain Linear velocity X to 5
*
(Mouse.X -self.X)--Constrain Linear velocity Y to 5
*
(Mouse.Y-self.Y)--Constrain Rotation to vectorToAngle(Linear velocity.X,Linear Velocity.Y )
Otherwise
--Change Linear velocity X to 0
--Change Linear velocity Y to 0
. . . . . . .
Adjust bounciness and friction (for both actors) to tune the collision behaviour.
Adjust the '5' value to tune tracking.
Thanks, that seems to do the trick!
Check out my video series on the gamesalad physics engine.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS