megatronx's Recent Forum Activity

  • All you need is the camera position (cx,cy,cz), the fov, and the scroll position (scrollx, scrolly) apparently. Math below is adapted from the Wikipedia about 3d projection.

    screenx = (x-cx)/(z-cz)/tan(fov/2)+scrollx
    screeny = (y-cy)/(z-cz)/tan(fov/2)+scrolly

    There is no expression to get the fov so you’ll just have to remember it from when you set it.

    Not tested.

    What this is for? What could I do with it too?

    megamente Br

  • I can't help you with that. I only use x,y,z from 3d plugin, but I do camera rotation with my own system that works with c2 stuff and is understandable to me ( I yet to understand rotation vectors and how to use them )

    This is using Simple Mouse Lock plugin

  • megatronx

    I have no input on that other than yes you can access values in an array immediately after you set them.

    Maybe your logic just isn’t correct for what you’re doing. It could be helpful to output what’s going on at each step to debug things. Or maybe simplify the data you’re using to be able to analyze what’s it’s doing better.

    As is I can’t make sense of it. Arrays are useful but i find code using them often unreadable

    Thanks for reply. Ok. But here I'm only working with one number, dividing it and adding to another array cell, o this is as simple as can be. When I'm checking < in condition, the division by 10 in action doesn't divide by 10. Will investigate further then.

    EDIT. It's working today :> Now I'm literally few days away from completing the mesh gen stage :)

  • R0J0hound

    Can you help me out with something. Not plugin related but Idk if this is a bug or wtf?

    In the for loop y2 x2, both from -1 to 1, i'm doing this test between numbers in cells at x2,y2,2 . I'm taking number from a cell at 1,1,2 ( green ) and checking it against 4 other cells ( red ) inside 3x3x4 array. I only want to calculate cells that contain larger number then central cell and then divide them. This is super simple. It doesn't work thou! If the condition with > is there, it calculates something else, and still calculates those cells that have bigger number then central cell number. Please have a look at it and tell me is it me or it is a bug? Thx!

    Other than this, I manage to program working 3D bitwise mapping system, and this is a way I wanted to test where walls should go.

    Here's the whole loop. Conditions above are working. And I got to admit, I wanted to make one more bit calculation with condition checking same numbers for whole day today and couldn't get it to check properly, so decided on something else, and still this isn't working.

    EDIT Just realized that the first >= condition isn't working, and is passing trough. Really got to figure out is it a bug or not. Or maybe filling up array and checking it within the same for loop doesn't work?

  • > 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.

    Thanks for help attempt but I've found where problems where made.

    Simply, I've made x and y in loops with wrong value, and then in another calculation I've had wrongly placed ().

  • R0J0hound I thought I'll let you know, If you will ever decide to do the 3D construct, I would like to help you out to the maximum of my abilities, that includes doc organisation, design, ui, some web stuff, and video and sound editing if you'd go for yt video like tutos ( I did a lot of official AOZ Studio tutorial videos ), and crowd founding.

    And a suggestion: it wouldn't even have to be an event based system, but having a language like Basic, which is pretty much what construct coding feels like, would be fully sufficient to make proper 3D indie games. Main thing would be renderer and that would have to be at a level of Manu at least.

  • 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!

    ROOJ said maybe he will do it. Nothing more.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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...

    I don't think there is and they ae two sided.

  • 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)

    You know, it's not a bad idea. There's godot with its scripting and manu, and maybe ROOJ will make his own software which I am looking forward too. When it comes to me, I know c2 very well and I want to make something in it before moving on.

  • > 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.

    Depends what you are using. If you are using tilemap then you got to check tiles in front of the player within distance and if you are using sprite object you could use line of sight "is in sight" condition, and then test for ray cast.

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

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

    Might not work straight away, you might need to change symbols from + to - for example to get correct direction, but if I recollect this is generally how you do it.

    And if you have sprite with line of sight then it will change the angle within the plugin itself automatically.

    But then you say it is like MC with loads of blocks. Max objects before NW.js starts slowing down is something like 40x40x2 ( this was my map x,y as well as objects for billboards above it , but more than that there will be a stutter, tested on i7-8750h as well as on 12700h! ).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. You will also need to keep track of which arrays been already used and which aren't. SO you could use second line of sight, larger and longer, and anything that is not in it will automatically have that flag set to off, and then from this pool you can pick as many as you have availed to fill up the terrain, while also keeping track of things in another array. This doesn't have to to work every frame thought, but every several ticks.

    Make yourself a tick clock. Have a global variable T and set it to (T+1)%6 for example, so this will give you numbers from 0 to 5, and then you can decide what happens when. Obviously action related stuff has to run every tick.

    This seams complicated but it isn't really, and you can have this system up and running within a day or two, just need to plan it out on page of a3 paper and you will know exactly what you are going to do.

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

  • 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.

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

  • megatronx

    I didn't found the page about Rojo talking about it, was he talking about cubes or triangles? (the triangles one I found, but I was hoping to find the one talking about the cube already made by him...)

    Also, have you done raycasting in you project? Or won't it have it?

    Hi, I will be doing raycasting at some point. I will share it with you once done, but that's still some time away. Right now I'm still designing level building system.

    As for the box, simplest way i think is to create a sprite 10x10px, set 4 origin points and then at start of the level use them when creating vertexes. You will need to create a plane 6 times and each plane is 2 triangles, so 6 verts in total per plane. The UV order for each plane is 00 01 11 11 10 00. Example of creating a plane for side using image point sprites:

    ip1 ip2 This is how the sprites imagepoints are set

    ip4 ip3

    And this is creating a plane for wall using imagepoint1 and imagepoint2

    -create vert at X ImagepointX(1) Y ImagepointY(1) Z 0 UV 00

    -create vert at X ImagepointX(2) Y ImagepointY(2) Z 0 UV 01

    -create vert at X ImagepointX(2) Y ImagepointY(2) Z 10 UV 11

    -create vert at X ImagepointX(2) Y ImagepointY(2) Z 10 UV 11

    -create vert at X ImagepointX(1) Y ImagepointY(1) Z 10 UV 10

    -create vert at X ImagepointX(1) Y ImagepointY(1) Z 0 UV 00

    Without imagepoints you create plane just like this

    -create vert at X -1 Y -1 Z 0 UV 00

    -create vert at X -1 Y 1 Z 0 UV 01

    -create vert at X 1 Y 1 Z 1 UV 11

    -create vert at X 1 Y 1 Z 1 UV 11

    -create vert at X 1 Y -1 Z 1 UV 10

    -create vert at X -1 Y -1 Z 0 UV 00

    Then you'd need to scale it. Doing it this way will create origin point in the center of the plane.

    When you will be creating plane for top and bottom of the cube, you have to use all 4 image points and keep Z at 0, but wij sides you need to use only 2 image points and instead increase Z by a number. The order of vert creation can change, but the first and last, as well 2 middle ones must be in the same point. You can experiment.

    Once you create all planes, use save verts as mesh. Call the mesh and then create object and use that mesh. If you want different textures on each side, you got to have a texture with those sides and then set UV in such way that it is drawing only those tiles of the texture.

megatronx's avatar

megatronx

Member since 25 Sep, 2008

Twitter
megatronx has 1 followers

Connect with megatronx

Trophy Case

  • 16-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

23/44
How to earn trophies