Jump to content

Marcousik

Members
  • Posts

    679
  • Joined

  • Last visited

Posts posted by Marcousik

  1. Quote

    Just a few thoughts that may or may not help;

      Quote

    roadModel:UpdateAABB(Entity.LocalAABB+Entity.GlobalAABB)

    Shouldn't it be;

    
    roadModel:UpdateAABB(Entity.LocalAABB | Entity.GlobalAABB)

    > I got it from there: https://www.leadwerks.com/learn?page=API-Reference_Object_Surface_Add

    Quote

     I'm not sure if that's needed to create a polymesh though...

    > No it is not needed.

     

    Thx for reply.

    I don't know where is the problem. In the editor you can easily collapse models with different surfaces/materials and generate a polymesh shape.

    But seems not possible in script. Because collapsing make the entire model with one unique material.

    I got the shape to be right generated with this:

    Quote

            surface:Add(surfaceB, mat)
            surface:Update()
            
             local shape = Shape:PolyMesh(surface)        -- THIS RETURNS the right shape for the 2 surfaces

    So I created 2 different models with each one one surface and it runs ok.

  2. mmh I don't get it to work.. Something must be wrong but I don't know what.

    But I could get it running by creating 2 differents models, but maybe worse for performances.

    Quote

        local roadModel = Model:Create()  

        --    roadModel:SetViewRange(Entity.FarViewRange)
            roadModel:SetShadowMode(0)
            roadModel:SetCollisionType(Collision.Scene)
     

            local surface = roadModel:AddSurface() 
            local surfaceB = roadModel:AddSurface() 
            local surfaceS = Surface:Create()

    -- road:
            surface:AddVertex(v0, n, Vec2(0,0)) --0
            surface:AddVertex(v1, n, Vec2(1,0))     --1
            surface:AddVertex(v2, n, Vec2(1,1))     --2
            surface:AddVertex(v3, n, Vec2(0,1))     --3
            
            surface:AddTriangle(0,1,2)  
            surface:AddTriangle(0,2,3) 
            surface:Update()  

    -- bankD 
            surfaceB:AddVertex(ve_1, n, Vec2(-1,0)) --0
            surfaceB:AddVertex(v0, n, Vec2(0,0))     --1
            surfaceB:AddVertex(v3, n, Vec2(0,1))     --2
            surfaceB:AddVertex(ve_2, n, Vec2(-1,1))     --3
            
            surfaceB:AddTriangle(0,1,2)  
            surfaceB:AddTriangle(0,2,3) 
            surfaceB:Update()  

    -- bankG 
            surfaceB:AddVertex(v1, n, Vec2(1,0)) --4
            surfaceB:AddVertex(ve4, n, Vec2(2,0))     --5
            surfaceB:AddVertex(ve5, n, Vec2(2,1))     --6
            surfaceB:AddVertex(v2, n, Vec2(1,1))     --7
            
            surfaceB:AddTriangle(4,5,6)  
            surfaceB:AddTriangle(4,6,7) 
            surfaceB:Update()  

            surface:SetMaterial(self.RoadMaterial) 
            surfaceB:SetMaterial(self.BankMaterial)

    --        roadModel:UpdateAABB(Entity.LocalAABB+Entity.GlobalAABB)

            local mat = Mat4()

            surfaceS:Add(surface, mat)
            surfaceS:Add(surfaceB, mat)
            surfaceS:Update()
            
             local shape = Shape:PolyMesh(surfaceS)        -- THIS RETURNS shape == nil      --  I don't know why
            roadModel:SetShape(shape)
            shape:Release()
     

     

  3. How should I set a complete polymesh shape with a script on a model with 2 surfaces?

     

    I construct the shape like this:

     

    local surf1 = Model:GetSurface(0)

    local surf2 = Model:GetSurface(1)

    local Shape1 = PolyMesh(surf1)

    local Shape2 = PolyMesh(surf2)

    Model:SetShape(--- ??? ----)   

     

    How to I set the two shapes on one model ?????

    Thx for help

  4. There are still people (I am one of them ^^) who still work with LE4.6 and try to build something / finish what they began

    I spent hours learning how to use it and I made progress in building a game, so that I want to finish it.

    And there is the very positive argument that the actual version 4.6 works stable and it will need a looooong time until  the new baby Ultra keeps a way without updates required. 

    So I enjoy working with 4.6 

    • Like 1
  5. Quote

    I don't know why Josh wouldn't just 

    Because he is completely concentrated on coming forward with Ultra engine.

    We all (are/have) missing a few thing in the actually LE that could made the editor just top, but well.

    Do you think about publishing your soft-Particles shader or make a tuto on this ?

    • Haha 1
  6. Quote

    When I run the ragdoll with SetParen, assigning as parent of the bone the rigid body. The ragdoll looks decent. The thing is that when I finish the ragdoll, I can't use animations like standing up. The skeleton is already related to the rigid body. 

    Ok. Did you try to unparent with SetParent(nil) ?

  7. Quote

    Then it is impossible to release the skeleton to apply an animation in which for example after a fall an animation of standing up is activated.

    Sorry this is not clear for me... Do you mean "...use the skeleton to apply an animation" ?

    I don't understand why you could not use the skeleton after the ragdoll goes to end ? Do you ?

  8. So in the theory I would try to release the joints and then play a simple animation to awake the character.

    If you can't release the joints, maybe try to set the friction to 0, so that the joints don't generate any force, just release the control.

    And I would try to Hide() the boxes to avoid strange collision problems, and to set the Mass to 0 after the ragdoll animation is finished.

    • Like 1
  9. Quote

    Now you get to see what I have discovered long ago. The place your are selling matters more than the actual product.

    And the scandal occasionned by selling a broken version of Cyberpunk 2077 on PS4 - whatever what everyone think about that - shows that not even quality is needed if you do an intense ad campaign to become rich & successfull. This is so crazy today.

  10. Quote

    An easier and more accurate way may be to grab each tire position and draw decals on the terrain at those locations.

    Thx, yes that was my method but it is not 100%. Calculatoin should be a mix out of velocity and rotation but I can't get it complete in my mind.

    I used a modified code from the decals used for the bullets tracks on walls. It runs ok if the car stays in a "normally predictable" line of drive but not if the car is suddenly sliding like in the gif.

    [Sorry I had problems by uploading / deleting example video]

    Quote

                local TirePos0=self.Tires[0]:GetPosition(true)
                local TirePos1=self.Tires[1]:GetPosition(true)
                local TirePos2=self.Tires[2]:GetPosition(true)
                local TirePos3=self.Tires[3]:GetPosition(true)

                local DecalPosY0=self.Terrain:GetElevation(TirePos0.x, TirePos0.z)
                local DecalNormal0=self.Terrain:GetNormal(TirePos0.x, TirePos0.z)
                local DecalPosY1=self.Terrain:GetElevation(TirePos1.x, TirePos1.z)
                local DecalNormal1=self.Terrain:GetNormal(TirePos1.x, TirePos1.z)
                local DecalPosY2=self.Terrain:GetElevation(TirePos2.x, TirePos2.z)
                local DecalNormal2=self.Terrain:GetNormal(TirePos2.x, TirePos2.z)
                local DecalPosY3=self.Terrain:GetElevation(TirePos3.x, TirePos3.z)
                local DecalNormal3=self.Terrain:GetNormal(TirePos3.x, TirePos3.z)

                local TireTrace0 = Decal:Create(self.TireTraceMat)
    --            local TireTrace1 = TireTrace0:Instance()
                local TireTrace2 = TireTrace0:Instance()
                local TireTrace3 = TireTrace0:Instance()

        
    --            TireTrace0:SetScript("Scripts/Objects/Effects/BulletMark.lua")
    --            TireTrace1:SetScript("Scripts/Objects/Effects/BulletMark.lua")
                TireTrace2:SetScript("Scripts/Objects/Effects/BulletMark.lua")
                TireTrace3:SetScript("Scripts/Objects/Effects/BulletMark.lua")

     

                TireTrace2:SetPosition(TirePos2.x, DecalPosY2,TirePos2.z,true)
                TireTrace2:AlignToVector(DecalNormal2,2)
                TireTrace2:SetRotation(0,self.entity:GetRotation().y-((10+Vit_locale.x*3)* self.turning),0)    -- TOP VIRAGE GAUCHE cad 

                TireTrace3:SetPosition(TirePos3.x, DecalPosY3,TirePos3.z,true)
                TireTrace3:AlignToVector(DecalNormal3,2)
                TireTrace3:SetRotation(0,self.entity:GetRotation().y-((10+Vit_locale.x*3)* self.turning),0)

    --    System:Print(math.abs(Vit_locale.x*20))

                local mat = TireTrace2:GetMatrix()
                mat[0] = mat[0]:Normalize() * 0.1--math.max(0.1, 0.2 * math.abs(Vit_locale.x))
                mat[1] = mat[1]:Normalize() * 0.1
                mat[2] = mat[2]:Normalize() * 0.2 * (self.vitesse/5)
                TireTrace2:SetMatrix(mat)

                mat = TireTrace3:GetMatrix()
                mat[0] = mat[0]:Normalize() * 0.1
                mat[1] = mat[1]:Normalize() * 0.1
                mat[2] = mat[2]:Normalize() * 0.2 * (self.vitesse/5)
                TireTrace3:SetMatrix(mat)
     

  11. I tried to write a script function   to trace tires tracks.

    Pretty easy with decals applied on Terrain if the car drives straight forward.

     

    But how to calculate the tracks rotation/ direction of such a mouvement??? Any suggestions?

     car drift GIF

  12. I worked on this and it runs ok in this code order:

    DISPLAY was the variable I wanted to save written.

    Quote

            local path = FileSystem:GetAppDataPath().."/MyFile.txt" 
            FileSystem:CreateFile(path) 
            local stream = FileSystem:OpenFile(path) 

            if (stream) then
                    stream:Seek(0) 
                    stream:WriteLine(DISPLAY) 
     --               stream:Seek(0)   -- debug
     --               System:Print(stream:ReadLine()) 
                    stream:Release() 
            end
     

     

×
×
  • Create New...