is there a way to “go around” the obstacles when using transition?
I am using the following code to move my player object
local movePlayer = function(event)
local distancep = math.sqrt((player.x - event.x) * (player.x - event.x) + (player.y - event.y) * (player.y - event.y))
transition.to(player,{time=distancep * 10, alpha=0, x=event.x, y=event.y,transition = easing.linear} )
end
However, i notice that it will just pass through the obstacle object even though i set the obstacle to “static”
You have to detect the collision between your player and your object and abort the transition if there is a collision. Transitions are not part of the physics engine and will move from point a to point b unless you stop it. [import]uid: 199310 topic_id: 37428 reply_id: 145593[/import]
Hello,
Certain things cannot be done in the same “app cycle” as a collision. In this scenario, you can use normal collision detection (not pre-collision), then on collision, perform your translate after a very short, imperceptible timer of 10-20 milliseconds. This should solve the error message you’re getting.
You have to detect the collision between your player and your object and abort the transition if there is a collision. Transitions are not part of the physics engine and will move from point a to point b unless you stop it. [import]uid: 199310 topic_id: 37428 reply_id: 145593[/import]
Hello,
Certain things cannot be done in the same “app cycle” as a collision. In this scenario, you can use normal collision detection (not pre-collision), then on collision, perform your translate after a very short, imperceptible timer of 10-20 milliseconds. This should solve the error message you’re getting.