Rojo3d. 3D engine for Construct 2

From the Asset Store
Casino? money? who knows? but the target is the same!
  • I think I might use local variables then. I didn't want use them before because I thought it would make the debug window be messy.

    Local variables wont appear in the debug until you set them to static. Just create Locals and then have second set of actions for debug and use whatever you want. Once you don't need the debug for that particular set of events just disable those debug events. This way you can program clean and debug at the same time.

    I will mess around with everything you told me and see what the result will be.

    ++ Try again with the Paster plugin with a can learn how to use it correctly.

    Do I have to position it behind the text

    Then I make its length the same of the text.

    Then I also I change the resolution to fit it's size

    Then? I use 'paste object'?

    This object must be a third object like a plane and that plane will 'screenshot' the area? Or the object selected must be the text?

    Why not have it simpler and have a speech bubble icon above object and when you approach it you'll get 2d speech bubble with text?

  • Why not have it simpler and have a speech bubble icon above object and when you approach it you'll get 2d speech bubble with text?

    Well, it's a good option and I think I might use this way. Although my objective it to create a '3D Game Template' and the way I am trying could maybe save a lot of time... or maybe just be a real shot in the dark...

    + With this I could also save a lot of memory since I won't need to save all the ballons sprites if I have a complex scene or if want to add a text typing effect.

  • Nope, Nope, NOPE! I am giving up! I will go and try again with the paster plugin... I just asked Phinder AI to help tell me what Camera Orientation (ThetaXYZ) is and how to get it... The response:

    Here is how you can convert the rotation matrix to Euler angles:

    1. ThetaX (Rotation around X-axis): This can be calculated from the elements of the rotation matrix. Specifically, ThetaX is the arctangent of -orientYZ / sqrt(orientYY^2 + orientZZ^2).

    2. ThetaY (Rotation around Y-axis): This can be calculated similarly. ThetaY is the arctangent of (orientXZ / cos(ThetaX)) / sqrt((orientXX^2 + orientXZ^2) / >(cos(ThetaX)^2)).

    3. ThetaZ (Rotation around Z-axis): This is calculated as the arctangent of (orientXY / cos(ThetaX)) / sqrt((orientXX^2 + orientXY^2) / (cos(ThetaX)^2)).

    Also in the end it will be only a shot in the dark.

    Last Edit: I think I am starting to understand how the Paster Plugin works, the Tunel might have a light!

  • I understood how the Paster Plugin works!!!

    :DDDD

    But I found a problem, the Paster plugin don't work to copy the text plugin 'sprite', since it's not a... sprite. Anyway, it does work with SpriteFont, BUT! It does have a clip frustum or something (srry I don't want to use translate) -- It disappear when outside layout

    Anyway I searched for one plugin I saw one time, and found this: (https://www.construct.net/en/forum/construct-2/addons-29/behavior-sprite-effects-amp-46890)

    R0J0hound you were here way before me, did you by any change have already downloaded this plugin? Because it isn't available anymore. If not, I might ask the guy who created the plugin and test if it works.

    Afte all, if nothing works, I still can try making loading screen that would hide the Paster Plugin behind a sprite and the SpriteFont behing the Paster plugin to load every text inside the scene.

  • Just move the paster object onto the screen before pasting to avoid the view culling. You can move it off screen immediately after.

    I never downloaded that plugin. I only have some of the plugins I made installed.

  • I understood how the Paster Plugin works!!!

    :DDDD

    But I found a problem, the Paster plugin don't work to copy the text plugin 'sprite', since it's not a... sprite. Anyway, it does work with SpriteFont, BUT! It does have a clip frustum or something (srry I don't want to use translate) -- It disappear when outside layout

    Anyway I searched for one plugin I saw one time, and found this: (https://www.construct.net/en/forum/construct-2/addons-29/behavior-sprite-effects-amp-46890)

    R0J0hound you were here way before me, did you by any change have already downloaded this plugin? Because it isn't available anymore. If not, I might ask the guy who created the plugin and test if it works.

    Afte all, if nothing works, I still can try making loading screen that would hide the Paster Plugin behind a sprite and the SpriteFont behing the Paster plugin to load every text inside the scene.

    Well done. I might get in touch how you did it.

    Here's Pode's plugins repository with the plugin that you want

    github.com/Pseudopode/construct2_plugins_behaviors

    github.com/JohnnySheffield/C2_Plugins_Pode

    And you can grab these I've downloaded from online repo from other creators.

    drive.google.com/file/d/195z3zWdD3DRfHEuRhUekBDGq_S4FkAra/view

  • Rojo: No it's the the Paster that have the culling problem, but the text object, although it's a good idea since C2 events works fast as a tick it would be almost invisible.

    Megatronx: thanks for the plugins, I think I might have a look for each of them. The insert text inside sprite behavior didn't work or I Just didn't understand how to use it correctly.

    I did a few more tests and figured out that if the Sprite font (hotspot: bottom-left) is located at (0; 0.1) the culling doesn't happen. So I still can have 1 line of text.

    Today I am away from my PC and I am going to sleep, I don't know you guys live because times changes, but for me it's already time for sleep.

    Tomorrow I might give you the code on how I did it.

  • megatronx

    If you don't understand any part, you can ask! :D

    *Currently I *Gave 3D Texts the....

    * Inside my project the MeshLoader Loads basically everything from 2D to 3D, like a placeholder

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • * Inside my project the MeshLoader Loads basically everything from 2D to 3D, like a placeholder

    Cool man, will look more in to it later, but on first glance pretty cool. But I think you could use more of c2 features to save yourself that much eventing. For example, instead of using variables to define object type, just use animation frames, animations from sprites. Those animation frames can also hold textures, positions etc Can have plugins loaded to use and reuse. If you clever about it you can minimize the amount of events needed. Planning takes longer thought.

  • Any tips for 3D lighting?

    What I was able to do so far:

    - On Start: Function "CallLights"

    - Function "CallLights": for each Light object - Function "UpdateLight"

    Param (0) = light level

    Param (1) = redcolor

    Param (2) = greencolor

    Param (3) = bluecolor

    Param (4) = alphacolor (I did nothing with this until now...)

    Param (5) = light.posX

    Param (6) = light.posY

    Param (7) = light.poxZ

    - Function "UpdateLight"

    -- For each object that isn't a ligth object (this condition is only for my project, as I said, Meshloader load/placehold everything that is 3D)

    -- (param(0)*10)/Distance3D(obj.x, obj.y, obj.z, param(5), param(6), param(7))

    -- obj red color = Function.Param(1)*Self.LightLevel

    -- obj green color = Function.Param(2)*Self.LightLevel

    -- obj blue color = Function.Param(3)*Self.LightLevel

    Image :D

    Problem? Here: I need to make this to verify if ther is a block blocking light, since a light on the ground cannot reach a cave level.

    I saw that it could load light block per block... How am I supposed to that mid-air? I have to place every non-block with 'air placeholder'?

  • Any tips for 3D lighting?

    What I was able to do so far:

    - On Start: Function "CallLights"

    - Function "CallLights": for each Light object - Function "UpdateLight"

    Param (0) = light level

    Param (1) = redcolor

    Param (2) = greencolor

    Param (3) = bluecolor

    Param (4) = alphacolor (I did nothing with this until now...)

    Param (5) = light.posX

    Param (6) = light.posY

    Param (7) = light.poxZ

    - Function "UpdateLight"

    -- For each object that isn't a ligth object (this condition is only for my project, as I said, Meshloader load/placehold everything that is 3D)

    -- (param(0)*10)/Distance3D(obj.x, obj.y, obj.z, param(5), param(6), param(7))

    -- obj red color = Function.Param(1)*Self.LightLevel

    -- obj green color = Function.Param(2)*Self.LightLevel

    -- obj blue color = Function.Param(3)*Self.LightLevel

    Image :D

    Problem? Here: I need to make this to verify if ther is a block blocking light, since a light on the ground cannot reach a cave level.

    I saw that it could load light block per block... How am I supposed to that mid-air? I have to place every non-block with 'air placeholder'?

    You need to pathtrace or raytrace from ach object within the range of the light to the light source and if there is a collision with block on the path ( assuming each of your blocks has it's own sprite object ), you test weather the path is between min and max z of the object, and if it isn't, it continues the path till it eventually reaches the source. You already did raytracing I think.

  • R0J0hound Can you help me with a plugin? I've asked chatgpt to write c2 plugin that would add expression to retrieve imagepoint name by index ( it would be very useful to me.) I'm not sure how to test it or turn it in to a plugin. Any chance you could give it a shot? Thanks! And Merry Christmas!

    // Define the plugin information
    function GetPluginSettings() {
     return {
     "name": "ImagePointName",
     "id": "ImagePointName",
     "version": "1.0",
     "description": "Get the name of an image point by index.",
     "author": "Your Name",
     "category": "General",
     "flags": 0
     };
    }
    
    // Define the plugin class
    function SetupObject(objectClass) {
     // Define the expression "imagepointName(index)"
     objectClass.AddExpression(0, ef_return_string, "imagepointName", "General", "Get the name of an image point by index.", "imagepointName", 1);
    }
    
    // Define the plugin instance class
    function InstanceType() {}
    
    // Define the behavior of the expression
    InstanceType.prototype.imagepointName = function (index) {
     // Get the sprite instance
     var inst = this.inst;
    
     // Check if the sprite instance exists
     if (inst) {
     // Check if the image point index is valid
     if (index >= 0 && index < inst.image_points.length) {
     // Return the name of the specified image point
     return inst.image_points[index].name;
     } else {
     // Return an empty string if the index is out of bounds
     return "";
     }
     }
    
     // Return an empty string if the sprite instance doesn't exist
     return "";
    };
    
    // Add the behavior to the object
    SetupObject(InstanceType);
  • You need to pathtrace or raytrace from ach object within the range of the light to the light source and if there is a collision with block on the path ( assuming each of your blocks has it's own sprite object ), you test weather the path is between min and max z of the object, and if it isn't, it continues the path till it eventually reaches the source. You already did raytracing I think.

    Bro? πŸ’€πŸ’€

    You suggested me to do Raytracing for each light?

    My Raycaster does a ray in one direction and it cost about 7 fps. What would happen to my PC I make the raycast in all directions at the same time and for literally each light in the scene? Idk maybe I am exaggerating, but IDK... I might test it anyway, but this week I don't think so

  • > You need to pathtrace or raytrace from ach object within the range of the light to the light source and if there is a collision with block on the path ( assuming each of your blocks has it's own sprite object ), you test weather the path is between min and max z of the object, and if it isn't, it continues the path till it eventually reaches the source. You already did raytracing I think.

    Bro? πŸ’€πŸ’€

    You suggested me to do Raytracing for each light?

    My Raycaster does a ray in one direction and it cost about 7 fps. What would happen to my PC I make the raycast in all directions at the same time and for literally each light in the scene? Idk maybe I am exaggerating, but IDK... I might test it anyway, but this week I don't think so

    You only test for lights within distance.

    If your light is dynamic, you could use A* pathfinding, or you could do a mix of variables and neighbouring tiles check, where if a neighbouring block has another block next to it at the angle towards light, then it is darkened, and you update only a single block on change of state.

  • R0J0hound is there a way for you to help me with getting textures to work? I tried to get a texture from a sprite and put it on a 3D object, but I just get errors or it doesn't show up

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