Hi there,
I have a character and a box, i can move my character against the box and it pushes it.
I am trying to add an animation to it.
local function pushing(e)
box01.Col = "box"
if(e.other.Col == "box" and e.phase == "began" and RobotPlayer.y \> e.other.y and RobotPlayer.x \< e.other.x) then
...--play animation
end
end
Player:addEvenetListener("collision" pushing);
-- This basically checks it's colliding with a "box" and whether the characters on the left side pushing right.
My problem is the initial time collides the animation works.
But if i stop moving and start pushing right again it doesn’t.
The reason is because when the character pushing against the box their collision boxes sink together a bit, then when i stop moving the character gets pushed out, but not all the way, so he never reached a e.phase = “ended”.
(if i walk left to cause “ended” phase and then right it works again.)
Is there a way to stop this sinking effect or to push the character out more?
I’ve tried fiddling with density.
I’ve also tried changing the e.phase = “moved” but then it just stops working.
So i’m trying to either trigger the ended phase on their collision or recheck if they’re colliding without began phase and continue animation.
Thanks!
[import]uid: 91798 topic_id: 19760 reply_id: 319760[/import]
[import]uid: 52491 topic_id: 19760 reply_id: 76563[/import]