Yes or No? - Physics vehicle and Containers...

Get help using Construct 2

Post » Mon Mar 04, 2013 7:04 am

I have a vehicle that is created with multiple physics objects connected by joints. I want to have the warp behavior on my object but it won't work since my vehicle uses physics: if I try it looks like it got sent through a warp gate gone wrong...

I need a Yes or No answer to the following question so I can proceed:
To handle is problem do I need to create variables for my object, detect when it is on the left or right side of the screen, destroy the object, then recreate it on the other side of the screen with help from the information style in the variables? If no, jump to section 88.

If the answer is yes then I have a few more questions.
1.The local variables I was planning to store for my vehicle were speed, angle and position; am I missing anything?

When I created my vehicle with physics all the pieces were aligned in the editor the upon startup they are connected with joints. I found containers don't preserve relative positions.
2.1 Is there an easy way to reposition all the parts when I recreate the vehicle on the other style of the screen?
2.2 How do I take angle into account too?

88. Is there another solution I'm missing?

Thanks!!!basspenguin2013-03-04 15:58:20
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Wed Mar 06, 2013 12:48 pm

Bump, bumpity bump?

Thanks!
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Wed Mar 06, 2013 2:57 pm

1.) velocityX, velocityY, angularvelocity, angle, position
2.) Use multiple origins on sprites to use as a consistent reference for positioning
3.) Object.angle

Though really you don't need to do any of this. When it goes offscreen to the right, simply change the position of the vehicle to the left. That way you don't need to recreate the object dynamically and all physics properties are maintained.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Wed Mar 06, 2013 7:45 pm

When using the physics behavior I thought we were not supposed to set the position directly like it says here since it "teleports" the object: https://www.scirra.com/manual/98/physics. But are you saying it makes sense in this case? If it's possible it sounds like the easiest solution.

1.) Ah, good point.
2.) That totally makes sense but I can't think of a way of aligning an image point on one object to an image point on a different object. Any ideas?
3.) I was actually referring to how to I take the angle into account when trying to alight objects dynamically. But If I can get your point 2 to work this doesn't matter.

Thanks!!basspenguin2013-03-06 19:46:11
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Sun Mar 17, 2013 10:02 pm

Anyone else have any opinions of setting the position of (connected) physics objects directly? Something that should never be done? Something to be used sparingly in certain situations?

Thanks all!
B
37
S
9
G
7
Posts: 143
Reputation: 6,017


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], HugeCube, imnotspecial, tomi71, totoe and 19 guests