MegaMente Br's Forum Posts

  • Forget what I just said, my code doesn't work at all, I forgot to move my camera lol, when I move it breaks the code...

  • This is for "3D Text", like when you pass nearby a NPC and have a ballon for dialog, or to display enemy health bar or as I said '3D texting'! :)

    Thanks R0J0!

    I will test it right now!

    This will be edited:

    Status: Final result: it doesn't BUT! You gave an idea and I think I might now can move on!

    Plus: I think I almost found a 'formula' by testing some other formulas and combining them and testing, etc.

    * Dictionary: DedicatedTo3DConversion

    * Add keys:

    ** DedicatedTo3DConversion.Get("Dist") = distance(x, y, camx, camy)

    ** Camera2D.Angle == Rojo Z rotation

    ** PlayerAngleY.Angle == Rojo Y rotation

    ** DedicatedTo3DConversion.Get("LayerWidth") = viewportRight(Layer)-viewportLeft(Layer)

    ** DedicatedTo3DConversion.Get("LayerHeihgt") = viewportBottom(Layer)-viewportTop(Layer)

    X2d: (DedicatedTo3DConversion.Get("Dist") * cos(Camera2D.Angle) * DedicatedTo3DConversion.Get("LayerWidth")*2) /(DedicatedTo3DConversion.Get("Dist") * cos(Camera2D.Angle) +DedicatedTo3DConversion.Get("LayerWidth"))

    Y2d: (DedicatedTo3DConversion.Get("Z") - DedicatedTo3DConversion.Get("CamZ")* sin(-PlayerAngleY.Angle) *DedicatedTo3DConversion.Get("LayerHeight")) /DedicatedTo3DConversion.Get("Dist") * cos(-Camera2D.Angle) + DedicatedTo3DConversion.Get("LayerHeight")/2

    *The last time I tested it was almost working just have to do some changes for when the object isn't at the players angle of view, but this is for later.

  • I am also using something to similar to what you did. Although I am not talking about player rotation/orientation. I am trying to figure out what those guys who developed 3D things were thinking (laughs even more like the Joker)... I am becoming crazzy ;(

    What I am trying to do is the function in most engines called as "WorldToScreenCoordinates(layer, posx, posy, posz)" and Construct 3 also have that, right now I just tried reading the code they have (Opening the 3d example project 'high-tech vision' and pression 'F12' to open Google Chrome DevTools and searched at 'Sources') and it was a bit complicated to find where it was since it was... well a big code :P ...

    Anyway, I found it, but I still don't get some parts and for the second one I guess I have answer...

    First! How do I get the value of 'viewportMatrix'

    Second! How do I get the value of 'projectionMatrix'?

    Is the First the values of (orientXX, orientXY, orie...)?

    The second one I think it is named as 'projMat' inside R0J0hound runtime.js code, I just have to figure out how to program javascript and add it inside Construct 2 as an expression.

  • R0J0hound megatronx

    Can any of you help me please?

    I am trying to convert 3D pos into 2D pos, but I had no success...

    {I forgot to completely translate the comment from portuguese to english, but

    the function call is:

    Function.Call("Convert3Dto2D", <layername>, x, y, z, camx, camy, camz)

    and ignore the extra things that are written there, it was for testing and it failed}

    *There is some events that were cut off... But it is basically:

    Rojo3D.orientXX("camera")+DedicatedTo3DConversion.Get("X") +

    Rojo3D.orientXY("camera")+DedicatedTo3DConversion.Get("Y") +

    Rojo3D.orientXZ("camera")+DedicatedTo3DConversion.Get("Z")

    ...... (and similar to the rest)

    * The yellow box is the image that I am trying to set the 2D pos from the 3D pos conversion.

    * The 3D pos is from that mesh that looks a lot like a Minecraft piston block.

    But the conversion isn't accurate and sometimes when I rotate the camera It gets off the object.

    Also, if I go foward the object it stills visible at screen

    Also+ , If I turn around from that position from last image I won't see it anyway and inside the debugg console will show it's position will be really away.

    *I think with these I could achieve the '3D text'

  • add n*( tSpace.At(1,1,0) = tSpace.At(x2+1,y2+1,0) )

    Sorry to be nosy, but are you trying to compare with a info inside the array is equal to another with a fórmula...

    And if it's: true - add the x value to array

    False: add value 0 to array

    ?

    It seems correct to me. Maybe you could try using the expression:

    {I put between parentheses to be easier to just copy and paste}

    * Remove que Comments I made...

    // Start Here (

    find(

    tSpace.At(1,1,0),

    tSpace.At(x2+1,y2+1,0)

    )

    <> //Not equal

    -1

    ) // End Here

    I think this expression might work.

  • I would also like to help, I am not good at coding, but maybe I could help with UI textures and everything related.

  • Hello, excuse me, with "hexa game" you mean those games that you shoot at a specific color and if it is the same color (similar to what happen in Candy Crush) every same color gets destroyed?

    (Sorry English isn't my native language)

  • R0J0hound

    Hey what's up again. Could you give me a hand? I am trying to use your plugin (paster) but I didn't understand how to use it. Basically I am trying to write a text using sprite font, then I want to take a 'screenshot' only the area of the sprite font object and after that I would use it as texture for 3D Text. Could you help me use your plugin (paster)?

  • megatronx

    Hey, do you know? Build each block from vertexes inside the game is there only way possible to 'disable' the invisible faces that are not being shown? maybe you had achieved this and I don't know...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • WOW!! Really?? I would love to see the project ROJO is working on... It will be similar to C2 engine? Or similar to Godot/Unity? I only knew about the existence of C2 three years ago during pandemy, also I only knew about ROJO I guess about 1 year ago...

    Seeing C2-like engines would be revolutionary!

  • Brooo.... I was searching for 3D Collisions and everything... I think it will be easier to learn how to program inside a 3D Engine, maybe it will be easier to learn all the Multiplayer mechanics for those 3D engines rather than learning how to implement a 3D Engine inside C2... Nah... (laughing desperately like the joker)

  • To calculate direction of casting depending on the players angle do something like this:

    ax= cos(player.angle) -distance, ay = -sin(player.angle) -distance

    Thank God! I've already passed this stage...

    So you will need to nest arrays, and depending on player position access them, then arrays within them and place blocks accordingly. To do that each block has to have a boo that defines its availability.

    I was trying to do some tests with that before, but I ran into a problem: Let's say that the player can Aim at the object 'ground' which is extremely large and it's origin point is centered, also let's say the player is right at the block edge, the "it's inside radius boolean" wouldn't detect because the tests I made only takes the player PosXYZ and object PosXYZ and don't take other important values to as its length...

    How could I make this 'algorithm'/'formula' to detect the distance from player and block? Maybe I could use a: "is overlapping object", but then I must do this detection in a loop for all the object what wouldn't be very optimal...

    Also, lest say your cube is 10x10x10, then you can repeat the ray test n/10 times, so per grid and not per pixel.

    It's a great idea, not gonna lie. But it would be only for a cube exclusive game. Since objects with meshes that don't will the cubic format would be detecting even if the player isn't looking at it.

    But everything you said gave me an idea... I will try my best to see if it works. Thank you! :D

  • You probably need to limit the ray tests to a distance. for each rayAsset, distance < then, raycast.

    But if there is too much objects inside a layout?

    Like inside a Minecraft world there will be a radius of 4 blocks and almost everytime there is a block around the player...

    In other words: it will always be casting rays anyway.

    I mean, maybe I could test if what you said but instead ofy position, I test the position of the point in the ray near to the block... That would be equivalent to what I am doing to test if the point is overlapping a 3d cube.

  • Seems interesting. I coded to cast a ray every 1/24 seconds and detect almost 304 different points in the ray of length 76.

  • Interesting, and thank you for the explanation I will try that, maybe It would be faster...

    ** About the raycast: I would be very interested too, soon I might upload here the template I made and it does have raycast, but it's laggy because it does too much collision checks per tick and it might not precise for very small positions also it only detect collisions for cubic meshes.