Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
3D - Page 2 — Gideros Forum

3D

2»

Comments

  • YanYan Member
    edited September 2019
    Those all must be much easier, too much code I cant understand immediately, there must be an abstraction level to handle all 3d Envirionment, such as object loading or working with coordinates. People who has weak maths, such as me, cant use those featuers.

    Just look on G3DFormat file - wicked for me!
    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    @Yan, you are welcome contributing :)

    @MoKaLux, here is the code:
    r3d=require "reactphysics3d"
     
    local sw,sh=application:getContentWidth(),application:getContentHeight()
    local scene=Sprite.new()
    local view=Viewport.new()
    stage:addChild(view)
    view:setPosition(sw/2,sh/2)
    view:setContent(scene)
    view:setScale(-sw/2,-sh/2,1)
    local proj=Matrix.new()
    proj:perspectiveProjection(90,sw/sh,0.1,1000)
    view:setProjection(proj)
    view:lookAt(0,5,-5,0,5,0,0,1,0)
     
    local cube=Mesh.new(true)
    cube:setVertexArray{
    	-1,-1,-1, 1,-1,-1, 1,1,-1, -1,1,-1,
    	-1,-1,1, 1,-1,1, 1,1,1, -1,1,1,
     
    	-1,-1,-1, 1,-1,-1, 1,-1,1, -1,-1,1,
    	-1,1,-1, 1,1,-1, 1,1,1, -1,1,1,
     
    	-1,-1,-1, -1,1,-1, -1,1,1, -1,-1,1,
    	1,-1,-1, 1,1,-1, 1,1,1, 1,-1,1,
    }
    cube:setGenericArray(3,Shader.DFLOAT,3,24,{
    0,0,-1,0,0,-1,0,0,-1,0,0,-1,
    0,0,1,0,0,1,0,0,1,0,0,1,
    0,-1,0,0,-1,0,0,-1,0,0,-1,0,
    0,1,0,0,1,0,0,1,0,0,1,0,
    -1,0,0,-1,0,0,-1,0,0,-1,0,0,
    1,0,0,1,0,0,1,0,0,1,0,0,
    })
    cube:setIndexArray{
    1,2,3,1,3,4,
    5,6,7,5,7,8,
    9,10,11,9,11,12,
    13,14,15,13,15,16,
    17,18,19,17,19,20,
    21,22,23,21,23,24}
     
    local gplane=Mesh.new(true)
    gplane:setVertexArray{-100,0,-100, 100,0,-100, 100,0,100, -100,0,100}
    gplane:setGenericArray(3,Shader.DFLOAT,3,4,{
    0,1,0,0,1,0,0,1,0,0,1,0,
    })
    gplane:setIndexArray{1,2,3,1,3,4}
    gplane:setColorTransform(0,0,1,1)
    cube:setColorTransform(0,1,0,1)
    scene:addChild(gplane)
    scene:addChild(cube)
    cube:setShader(Lighting.normal_shader_b)
    gplane:setShader(Lighting.normal_shader_b)
    Lighting.setLight(-4,10,0,0.2)
     
    world=r3d.World.new(0,-9.8,0)
     
    body=world:createBody({x=0,y=10,rx=-10,rz=40})
    box=r3d.BoxShape.new(1,1,1)
    fixture=body:createFixture(box,nil,1)
     
    plane=world:createBody{}
    plane:setType(r3d.Body.STATIC_BODY)
    pbox=r3d.BoxShape.new(100,1,100)
    planefix=plane:createFixture(pbox,nil,1)
     
     
    stage:addEventListener(Event.ENTER_FRAME,function(e)
    	--print(e.deltaTime)
    	world:step(e.deltaTime)
    	cube:setMatrix(body:getTransform())
    end)

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • excellent, looking forward to using it. I have never coded in 3D before and would be delighted to do it in gideros. Thank you very much hgy29.
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    Accepted Answer
    A bit more evolved example:

    Likes: MoKaLux, oleg

    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29 said:

    A bit more evolved example:

    Is it possible to make a 3d object a button?
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • hgy29hgy29 Maintainer
    oleg said:


    Is it possible to make a 3d object a button?

    With the help of reactphysics3d engine, yes: it has raycasting functions that could be used to check for 'click'.

    Likes: oleg, PaulH

    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29 said:

    @Yan, you are welcome contributing :)

    I'd like to, but my Java is on zero level ))

    vk.com/yan_alex
  • hgy29hgy29 Maintainer
    I decided to try to render shadows. It took a few minors changes in Gideros rendering code, mainly the ability to render depth result to a rendertarget. Here is the result:
    +1 -1 (+4 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    Now with textures:
    Nice isn't it ?
    +1 -1 (+3 / -0 )Share on Facebook
  • impressive indeed.
    is the gravity intentionally low or it is slower due to computational power?
  • hgy29hgy29 Maintainer
    Gravite is set to 9.8, but the units are what you want anyhow. However the floor reaction isn’t good, because it’s mass is the same as the cubes, which isn’t realistic. However for the demo I wanted the cubes to bounce all over the place.
    Throughout the video the FPS is a solid 60, with roughly 3% cpu usage. But this is on my pc, I don’t have figures for mobile yet.

    Likes: talis, MoKaLux

    +1 -1 (+2 / -0 )Share on Facebook
  • Apollo14Apollo14 Member
    edited September 2019
    Nice! o:) If I hadn't my freaking long project, I'd try to make Helix Jump prototype out of curiosity for 3d

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • hgy29 said:

    Gravite is set to 9.8, but the units are what you want anyhow. However the floor reaction isn’t good, because it’s mass is the same as the cubes, which isn’t realistic. However for the demo I wanted the cubes to bounce all over the place.
    Throughout the video the FPS is a solid 60, with roughly 3% cpu usage. But this is on my pc, I don’t have figures for mobile yet.

    Waiting for the mobile figures here :)
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29 said:

    Now with textures:
    Nice isn't it ?

    Indeed it is, seems really nice, thanks for the resarch and implementation. I am sure when it will finish a small demo of this implementation will bring lots of new faces to our community.
    +1 -1 (+4 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    Attempt at a classic game. I love reactphysics3d!
    +1 -1 (+2 / -0 )Share on Facebook
  • if you can shoot those barrels then we could probably shoot some weird aliens from outta space too! :)

    Likes: hgy29, Apollo14

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+2 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    It opens a lot of possibilities to gideros: sport simulation (bowling, golf, ping pong, etc), 3D shooters, space game (doigt fight, mining, platform docking), 3D racing, aircraft simulation,...
    +1 -1 (+5 / -0 )Share on Facebook
Sign In or Register to comment.