Hi dear members of the forum. I would like how to achieve this:
I.- A platform that when player jump from below, pass trough, but onces player is on platform it becomes like an static object. (pic 1: like for example in Super Smash Brother games, you can traspass the platform when jump from below, but you step on it when you are on it).
II.- I just noticed that when I press “P” (play) the interior faces of objects becomes transparents. Or in a Plane object, if see from below and press play, the down face becomes transparent. How can I avoid this? I want to use some plane objects to be available to see from different angles. (pic 2)
1.) I have in the past just had a second invisible platform that slid to cover the platform when the player’s z position was greater than the z position of the platform. It’s a bit of a hack but it worked well.
2.) This is how face normals perform in the bge. You can chose to show the ‘backfacing normals’ in the materials panel by un-checking the “Backface Culling” check box in the Game Settings rollout. You will have to be in Blender Game made to see this option.
For the transparency issue try recalculating normals. Ctrl+N or Ctrl+Shift+N.
As for making an object one-pass, there’s a couple of ways to do it (most of which I can’t seem to remember right now, at least not in the BGE). Here’s one thing you can do:
Add a plane (this is going to be the actual platform). Go to the Material Panel and head over to Game Settings. Make sure Backface Culling is on.
If you want the player to jump, but not fall through the platform, make sure the front (visible) part of the face is pointing up.
Voila.
Set the plane to ‘invisible’ in the Physics Panel, and align it with the top of a modeled/textured platform (set this one to ghost). This way, you have an invisible plane for the mechanic, but the player sees a ‘one-side pass through’ textured platform.
Just so you don’t baffle DMNQ: I told him to recalculate normals for the transparency issue, not the ‘one-side-pass’ method. The first line of my reply refers to the second problem, where the cube is partially transparent due to uneven normals. Speaking of, it too can be fixed by checking Backface Culling off.
The physical collision workaround is lines 4 through 10. Just in case I was misunderstood.
Thanks Loyhogg and Crichton. Effectively, with Backface Culling option the transparency of inside faces got solved.
Loyhogg: The idea of making a sliding platform that appears once player reach some location in Z axis is fine, but if playing multiplayer, and a second (or more) players come back and do same will collide with already slip platform.
Crichton: I tough that without Backface Culling, cause can’t see one face, you could traspass that face, but doesn’t work. Tried what you said and don’t work neither that way.
Thanks a lot for your help and quick reply. If have any other idea how to reach that, please tell me (to pass through one side, and collide the other).
What about having it player based? Is this a sidescroller by the way? If so, you could just bump the player towards the camera when underneath the platform then push it back when above? Would only work if it’s a 2d sidescroller.
If you gave each player their own collision group and their own platforms that moved back and forth, you could do it. Most games probably just handle those cases themselves (i.e. they handle gravity, or treat “actual ground” the same as a “ghost type ground”). The way I would do it is to set up movement normally and lock the player to either the physical ground or the “ghost, one-way” ground.
One method would be to inspect the velocity of the player when it Collides With the plane. You can check the angle of the normal and the velocity. If you take the dot product, it will be less than 0 if the velocity is away from the normal. If you use a collision sensor (or the callbacks) to keep track of collisions, you can then determine whether the player is walking the wrong direction into the plane, or didn’t quite pass though it and falls back through. (the latter would still be colliding with the plane. Therefore only ‘new collisions’ between the player and the wall should cause them to repel one another. To actually implement this you will need two planes. One is used to detect collisions (it should be a ghost object) whilst the other should be a normal collider. Give the collided plane a special collision group, then give it a collision mask that includes the player group). Then, selectively enable the mask in the player that corresponds to the wall group with consideration to the criteria outlined above.
Thanks again Crichton & Loyhogg; SolarLune, agoose77 and BluePrintRandom. You guys gave me some nice ideas to achieve this. But as you said, will depend the kind of game to make it in one way or another.
Thanks you so much for the suggestions and your time, I really appreciate.