Hi all,
i’ve got a ball going through moving bricks. On the way up they are going THROUGH the bricks. and BOUNCE on the way down.
To allow the ball go through on the way up i’ve used preCollision and event.contact.isEnabled = false
Both the ball and the bricks are physics objects
it works … but going through the bricks, the ball is slowed down dramatically.
e.g. with a vy velocity of -400 if it doesn’t touch any bricks the ball goes all the way to the top of the screen, if going through the bricks it will only pass 2 or 3 going to 30% of the screen.
I thought that the event.contact.isEnabled = false would make the collision event do nothing ? therefore
letting the ball go through without slowing it down ?
local function on\_ball\_precollision(self,event) --print( "preCollision: " .. self.myName .. " is about to collide with " .. event.other.myName ) if (self.myName == "myball" and not(event.other.myName == "floor")) then -- means collision with a brick local vx, vy = myball:getLinearVelocity() print ("precollision:", "\<\>",event.other.myName,"\<\>",vy) if vy \< 0 then if (event.contact==nil) then else event.contact.isEnabled = false end end end end
Am I wrong ? if so, is there another method to let it go through ? (i cant set the ball as “kinematic” otherwise it keeps going up, never come down …
thanks !
Edualc