INSIDE THE TRAIN

Go inside the "train". To stop press the "s" in the keyboard. To go again, press "g".

We have used setCollisionCallback to detect the collision against the "wall" of the train and frozen some avatar movements (using a flag):

 myworld.model("avatar").collision.setCollisionCallback(#col, me)
...
etc.etc.
...
on col me, collisionData
 if (collisionData.modelA = myworld.model("avatar") ) then
   link = 1
  end if 
end
...
on control me
 if link=1 then
  myworld.model("avatar").worldposition =  myworld.model("land1").worldposition
 end if

 if keypressed("s") then 
  myworld.model("land1").keyframePlayer.playRate = 0 --land1 is the "train" 
  myworld.model("t1").keyframePlayer.playRate = 0 --t1 and t2 are the walls odf the train 
  myworld.model("t2").keyframePlayer.playRate = 0 
 link=0
 end if

and the movements are liberated (using the flag).


PREVIOUS NEXT
T. CONTENTS HOMEPAGE