Wrap wont work on physics ball?

  • Hi

    Capx

    Link is modified with the functioning portal! Thanx to Yann's tips!

    Edit: Capx is removed from server.

    I am trying to build a portal in my "sortof" pinball meets angrybirds game and i want to do it by using the wrapping behaviour.

    Im intending on having a invisible wall on the left and right side of the layout that moves in sync with the Y axes of the ball.

    When the walls then overlap a portal sprite that are also on the left and right side of the screen, i intend to set the walls to some other position so that the ball can go offscreen and wrap around it.

    This way i can keep the angle and speed of motion intact.

    And thus i create the illusion of a portal.

    To do this however i need the green ball to wrap around the play area and as u can see in the capx it doesnt.

    Any idears on why it wont wrap so i can fix it?

    Thanx in advance!

    I really enjoy learning C2 <img src="smileys/smiley32.gif" border="0" align="middle">

  • If I remember correctly, teleporting a physical object causes it to travel the distance in one tick, which makes it unstable to calculate.

    I suppose you can create a new ball in the opposite X or Y of the screen and give that ball a velocity of the ball that left the screen, then destroy the other one.

  • Yeah. Make sure you have read both physics tutorials, which discourages you from 'teleporting' physics objects.

  • Ah thanx on the advice!

  • IMHO you CAN "teleport" physic objects....I ve been doing it quite often, but if you do it "visibly" you have to expect strage things to happen

  • Maybe you can:

    • store the current velocity of the object in variables
    • teleport the object
    • set the velocity to 0,0 to avoid weird behavior
    • and then reset the velocity as it was next tick.

    If you have some rotation you might need to store/lock/reset angular velocity as well.

    Never tested though

  • Thanx Yann and Weishoupt

    Il try the method yann is sharing.

    Il report back when i do or dont have suc6.

  • Thanx Yann!

    It worked <img src="smileys/smiley36.gif" border="0" align="middle">

    The links below show pictures of how ive done it.

    The CapX on the top of this page is update with the working version.

    Picture 1

    Picture 2

    Picture 3

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Is there any chance you could post your capx or the images again somewhere? I'm interested to see how you resolved this.

    Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)