Wrap wont work on physics ball?

Get help using Construct 2

Post » Sat Feb 18, 2012 9:53 pm

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 Savvy0012012-02-27 20:00:34
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Mon Feb 20, 2012 1:22 am

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.
B
22
S
3
G
6
Posts: 59
Reputation: 4,450

Post » Mon Feb 20, 2012 2:21 am

Yeah. Make sure you have read both physics tutorials, which discourages you from 'teleporting' physics objects.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Feb 20, 2012 8:35 am

Ah thanx on the advice!
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Mon Feb 20, 2012 12:04 pm

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
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Feb 20, 2012 12:23 pm

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
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Feb 20, 2012 5:22 pm

Thanx Yann and Weishoupt

Il try the method yann is sharing.
Il report back when i do or dont have suc6.
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Mon Feb 20, 2012 8:02 pm

Thanx Yann!
It worked
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 3Savvy0012012-02-20 20:03:44
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Tue Jun 12, 2012 5:38 pm

Is there any chance you could post your capx or the images again somewhere? I'm interested to see how you resolved this.

Thanks.
B
3
Posts: 4
Reputation: 458


Return to How do I....?

Who is online

Users browsing this forum: marekmk and 3 guests