Phizix Extension Questions -- Several and Random
Hi Everyone!
I've been around these forums for a while, but I finally got an account up and running. I'm fairly new to MMF2, yet I'm jumping right in and using it for a class project.
I've got a few questions regarding the Phizix extension, and if anyone can help I would be very grateful. I've combed through the forums to try to get some answers, but nothing really answers my question directly. If I am creating some repeats, please forgive me!
1. Why do certain Phizix created objects have to have qualifiers? (I watched a tutorial, yet it was never explained). Is it only static objects? Objects that are obstacles?
2. By making an object an "obstacle", what does this do in regards to other Phizix bodies that aren't obstacles?
3. When I make a custom shape (by going to Body > Create > Add Custom Body, what are the (X,Y) coordinates relative to? Are they relative to the active object's hot spot or action point that I'm attaching to the body? I played around with this a bit and got some very strange results.
4. Is there any way that I can see an outline of the Bodies I create using the phizix extension?
5. How do I make an active object that is attached to a phizix object move in the Y direction on the press of a key? I saw in the example how to make it rotate around a joint, but I want it to follow a movement similar to a "path" style movement where it comes up and down again. Any ideas?
Also, another random question: is there any way that I can look at the actual code behind all of this?
I would post a file if I had something to show. If you'd like to see the really strange work around I've created for my game so far, I can post that at some point. I'm making a music/puzzle game that utilizes the Pinball movement, but I'm having horrible collision problems. I'm asking all of these questions with the hope of re-creating my game with the Phizix Extension so that the collision isn't broken.
Phew! That was a lot. Thanks for reading all of this! I look forward to a response.
Re: Phizix Extension Questions -- Several and Random
1. They don't have to use any qualifiers. Qualifiers was just used in the examples to make things easier.
2. Phizix cannot and will probably never use MMF's collision system. Setting an object to be an obstacle won't affect anything related to Phizix (unless you are using some terrain generator, some demos do, I think).
3. The X,Y coordinates are relative to the body, attached actives are attached by their hot-spot, so I guess you could say they are relative to the hot spot as well. Note that if the body is rotated, so will the coordinates.
4. No easy way with the Chipmunk version, the Box2D version has a debug-draw for this purpose. The Destructible Terrain Example has an example of how you can draw all line-segments of the ground body using an overlay.
5. You can move a body by applying forces or by directly setting the body's velocity. If you want it to move along a specific line as in the Piston Example you can attach a slider joint to it.
Not sure what you mean by looking at the code behind it...
Re: Phizix Extension Questions -- Several and Random
Thank you!
I'm still having a lot of trouble wrapping my head around how to build the architecture for my game, but having some of these questions answered helps a lot.
I appreciate your time :). If I have more questions, I'll probably post them here if you're up for answering more.
As far as the comment about looking at the code behind it, I mean to say that I am wondering if there is a way for me to look at all of the code in a manner that isn't visual. In other words, I want to see the "if (!boolean) {" to get an understanding of how things are talking to one another.
But maybe it's all clearly laid out for me in the Event Editor and I just don't fully understand it yet >.>
Re: Phizix Extension Questions -- Several and Random
Just thought of a question!
I noticed in the Pinball example that lines 31 and 33 have a red X in front of "Repeat while 'A' is pressed". I'm assuming that it's checking to see when A is not pressed. Is this correct? And if so, how do I create a statement like that?
Re: Phizix Extension Questions -- Several and Random
Right click the condition and select "Negate". It works for most conditions but not all.
Re: Phizix Extension Questions -- Several and Random
If I was to hit "negate" "Upon Pressing A Key", that essentially means "When the user is NOT press A", right? That's what negate means?
Re: Phizix Extension Questions -- Several and Random
Quote:
Originally Posted by Sedition
If I was to hit "negate" "Upon Pressing A Key", that essentially means "When the user is NOT press A", right? That's what negate means?
yes that is correct
Re: Phizix Extension Questions -- Several and Random
I'm having a hard time understanding where the Phizix created bodies are being attached to the Active Objects. I put the hot spot in the center of a rectangle and created a rectangle body and it appears that the rectangle body is not aligned with the Active Object rectangle.
How is it attaching the body? Where is the "hot spot" on the body created by the Phizix extension? Top right? Top left? Center?
Thanks!
Re: Phizix Extension Questions -- Several and Random
The center of the body depends on where you create your shapes. Or rather, you add the shapes relative to the body's center point. Active objects are attached to this point. When you add a box to the body it's added relative to it's center, so if you add it at 0,0 the center of the box will be at the body's center.
Note that in chipmunk the body's position is the same as it's center of mass, so if it's not at the middle the body might behave strangely.
Re: Phizix Extension Questions -- Several and Random
Wow, thank you! That was really helpful, and it explains a lot.
Re: Phizix Extension Questions -- Several and Random
I am currently attempting to make an animation go to another frame once two keys are pressed at the same time. I've put them in the same condition, yet it does not work.
Should I make a loop that checks to see if they are playing? I'm not sure how to set this up.
Any ideas?
Re: Phizix Extension Questions -- Several and Random
You need to use "repeat while pressing" for both, followed by "only one action when loops". You can't physically "on press" two keys at the same time.
Re: Phizix Extension Questions -- Several and Random
Oh man, thank you so much. I've been hitting my head over that for a while.
Learning so much everyyy day.
Re: Phizix Extension Questions -- Several and Random
I'm having a lot of problems getting bodies to attach the way that they should. I'm making a 2D game, should I use the 2D phizix engine instead?
Re: Phizix Extension Questions -- Several and Random
Attaching objects should work the same for both extensions, the main difference is the engine they use (Box2D and Chipmunk). The chipmunk engine is a 2D physics engine as well.
How exactly are they not attaching properly?
Re: Phizix Extension Questions -- Several and Random
For instance, I attach a rectangle body to a rectangle active object, and the rectangle does not seem to line up at all. The same problem happens when I attempt to create a custom object. Is there a specific place that the hotspot should be located in order for them to line up properly?
Re: Phizix Extension Questions -- Several and Random
The hot spot must be at the body's origin, where the origin is depends on where you create the shapes. Boxes are created relative on their center, so the hot spot would normally be placed at the center too.