Rojo3d. 3D engine for Construct 2

3 favourites
From the Asset Store
Casino? money? who knows? but the target is the same!
  • In general I'd recommend using the paster object instead of canvas for performance reasons. That said I have no solution for this. What happens when loading a texture from an url is the texture is set to some temporary texture until it's loaded. Hence the flicker.

    Any fix would have to be internal, but I'm not working on this anymore. I simply don't have time to fix things if I accidentally break it. But what would need to change is either keeping the current texture until the new one was loaded or making the copy from sprite action support other types beyond sprites. The plugin wasn't really made with other object types in mind.

  • got yah.

    I was able to get around it by using a sprite as a middleman, the now paster object's texture is loaded to the box object. and when that url is done loading from the "on image URL loaded" event the sprite is then loaded onto the 3d object.

    It is definitely not the optimal way to do this. But as long as I am careful to manage paintable surfaces and texture sizes it should be manageable. doing a test with surface sizes of 1920x1920 X 8 test surfaces I get about 147.48MB image usage. if later on it becomes an issue again I may take a look at modifying your plugin in some way if you are ok with that.

  • playing around with loading a 3d object I seem to have missing faces. in blender, I selected all faces by material and then exported them as individual objects (I don't think I can apply multiple textures to the same object by use of the mtl file) but for some reason, some faces disappear in the addon. It's odd because if I load the same parts in a model viewer they show up fine.

    It also seems to only affect these ramp areas.

  • ah I changed some export options and now it has no issues.

    I don't suppose there is a way to cast a ray or otherwise check the height of a point on an object?

  • No raycasting or collision detection was added.

    A raycast could be done by finding the intersection between a ray and a triangle. Well, all the triangles (or less if a spatial partition is utilized) and just keep the closest. You just need the triangles of the mesh to be transformed to world space for each object. Currently that is done on the gpu, so it would have to be done on the cpu.

    In some cases you can do something simpler. Say you just have a heightmap you can query the z at some xy with an array or something. Like say you have the mesh made up in blender you can render the zbuffer from above and load that image to query zheight from pixels. Only 255 levels so it may be a bit coarse.

    Another idea is if you are just using primitive shapes you can do a raycast with signed distance fields (SDF). I made a simple C3 example of this somewhere. It could be useful in some cases.

    If you just need the position of a point on a mesh, you can position another object relative to a different one and you can get the transformed position from expressions. It's probably not what you're after though.

  • I was thinking of using a height map myself so I will go with that. it's easy to do in blender. my test level only goes up to about 140 so I should be good as long as I lerp between where you are and where you are going.

    I made a shader for the object that colors it based on the height of the vertex. and with the camera set to Orthographic, I get a good height map

  • Ok got a new issue.

    for some reason when the camera is angled between 90 and 270 it flips upside down. I made sure to force the player sprites rotation between 0 and 360, and not -180 and 180.

  • figured it out. I was using the "set angle" command instead of the "Set Euler" still not sure why that affected it 100% but no doubt it's related to Gimbal Lock.

    things seem to be lining up nicely now. still some work to do before everything translates correctly from 2d to 3d. but I'm happy

  • Sir LoLz

    Did you find a way to calculate 3D physics? Or you just made the 3D ramps at the (0, 90, 180, 270, 360) degrees?

  • Sir LoLz

    Did you find a way to calculate 3D physics? Or you just made the 3D ramps at the (0, 90, 180, 270, 360) degrees?

    What I did is add chipmunk physics because it lets me run calculations after a hit is made but before a result is applied. so over my height map I place wall objects where elevation is severe. I then calculate the player's Z VS the Z of where they are going. if the players Z is higher then it means they would be falling off. but if they are lower then they hit a wall. I need to iterate more on this function as it does not work around corners. but it's a great proof of concept so far.

    I also added a boolean to lock the player to the ground. used to keep the player touching the ground if the z change is so small you don't want the player to "float" to it. so that way you don't float down inclines"

    On that note, tho R0J0hound something is up with the physics. a player may hit a wall and it stops correctly. I use "on pre-step" to see if they should hit the wall or fall off the elevation the wall separates. it works fine but the trigger is not reset until the player steps back. Ideally, I would want the player to be able to hit a wall and be stopped. but to then be able to jump and then clear the elevation difference. any advice?

  • i tried saving the last x and y of the player hoping I could jump back to that in order to allow a new "On pre collide" to happen. but it seems to do nothing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I haven’t messed with prestep with chipmunk physics too much to be honest. At the time I was just exposing as much as I could to the plug-in.

    You may be able to rework the logic to not be reliant on prestep being triggered again. But I don’t have any concrete ideas on that front.

    You could use rotated box sdfs to do the collision detection and response so you wouldn’t need to use a physics library and allow more control. Just as long as the player can be thought of as a point or ball. It even works with 3d boxes with minor modification.

    Guess an example is better. Give me a bit. I probably stick with vanilla construct features though.

    edit:

    Basic example of 3d physics with z-rotated boxes and a heightmap.

    dropbox.com/s/nhh07w51gex0q1j/3d_collision_detection_response_sdf.capx

  • That is a good system. I will consider that. though I may want some physics such as being pushed.

    I found a better method than what I was doing before though. I poll each pixel around the player every time they move a certain amount. and create dynamic solids as needed.

    On the left, the player is climbing a ramp by an edge. The pixels on the left are green because while they may be higher than the player. They are below a climb threshold I set. (player.z + climb) So the player can freely move there.

    On the right, though the player is on ground level. The elevation above is taller than the climbing threshold.

    these are calculated at the player's current height. So any jump/fall the player is doing will be factored into this dynamic solid creation.

    I am very pleased with this because it is dynamic and does not need me to do any walls beforehand. It goes off the already existing height map. I will optimize it later but it's a good proof of concept.

  • Thanks Rojo, your plugins with the ones of REX, had changed my life, really...

    This is amazing one! gonna explore!

  • I made a template with your engine:

    https://bruxabranca.itch.io/imp-puncher-template

    Extraordinario, show de bola!

    Great Work!

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