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

  • 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... <img src="smileys/smiley11.gif" border="0" align="middle" />

    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!!!

  • Bump, bumpity bump?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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!!

  • 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!

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