Quote: "maybe u can use StepPhysics(t) positive to run some steps invisible forward , memory the fly position and
then run the steps negative to go back your normal position. "
Unfortunately you can't run the physics backwards (it's logically impossible), but expanding on this idea, I could simply record the positions/angles/physics movements for every single object in the scene, then step forward the physics for a few seconds while recording the object's position (it's a bunny, btw). Then reset all the positions/angles/physics movements to all the objects.
I'll try this soon and post back here with the result
edit/: It works!! [attached, use left click to pan and right click to zoom (move left and right) get the bunny into the door]
Code I use:
(wall[] is an array (UDT) containing the data for all the walls. aims[] is an array containing the sprite-id's for the 60 red dots, they're created when you tap on the bunny and deleted automatically when you release, tapping is a global flag to say if the user is tapping on the bunny)
function DrawAim()
x# = GetspriteX(bunny)
y# = GetspriteY(bunny)
a# = GetspriteAngle(bunny)
vela# = GetSpritePhysicsAngularVelocity(bunny)
velx# = GetSpritePhysicsVelocityX(bunny)
vely# = GetSpritePhysicsVelocityY(bunny)
dim posx[60] as float
dim posy[60] as float
print(vely#)
if tapping=1
`*
for k = 1 to 99
if GetspriteExists(wall[k].id)
wall[k].x = GetspriteX(wall[k].id)
wall[k].y = GetspriteY(wall[k].id)
wall[k].a = GetspriteAngle(wall[k].id)
wall[k].vela = GetSpritePhysicsAngularVelocity(wall[k].id)
wall[k].velx = GetSpritePhysicsVelocityX(wall[k].id)
wall[k].vely = GetSpritePhysicsVelocityY(wall[k].id)
if wall[k].typ = wall_dynamic
SetSpritePhysicsOff(wall[k].id)
SetSpritePhysicsOn(wall[k].id,1)
endif
endif
next
SetSpritePhysicsImpulse(bunny,GetSpriteX(bunny)+1.7,GetSpriteY(bunny)+2.5,(GetSpriteX(bunny)-ScreenToWorldX(x[1]))*2,(GetSpriteY(bunny)-ScreenToWorldY(y[1]))*2)
for k = 1 to 60
update(0.05)
posx[k] = GetSpriteX(bunny)+1.7
posy[k] = GetSpriteY(bunny)+2.5
SetSpritePosition(aims[k],posx[k],posy[k])
next
for k = 1 to 99
if GetspriteExists(wall[k].id)
if wall[k].typ = wall_dynamic
SetSpritePhysicsOff(wall[k].id)
SetSpritePhysicsOn(wall[k].id,2)
endif
SetSpritePosition(wall[k].id,wall[k].x,wall[k].y)
SetSpriteAngle(wall[k].id,wall[k].a)
SetSpritePhysicsAngularVelocity(wall[k].id,wall[k].vela)
SetspritePhysicsVelocity(wall[k].id,wall[k].velx,wall[k].vely)
endif
next
SetSpritePosition(bunny,x#,y#)
SetSpriteAngle(bunny,a#)
SetSpritePhysicsAngularVelocity(bunny,vela#)
SetspritePhysicsVelocity(bunny,velx#,vely#)
endif
endfunction