Jump to content

Wrong position of imported object.


Braqoon
 Share

Recommended Posts

Hi, This might be trivial but not sure how to solve this. I have crated a simple model in Blender with texture and exported it to .fbx. Imported that to Leadwerks without issue, set collision mesh and placed in 3D space (see attached pic). This is my character in the game ,  Roomba like cleaning robot. So when i start the game , robot gets flipped 90 degrees. What gives ? When i create a simple cylinder, size of of my object and attach my player script all is fine, cylinder does not flip, and works just fine. Not sure what's going on, any help apprecieated. Player script below.

function Script:Start()
    --Create a camera
    world:SetAmbientLight(0,0,0)
    self.camera = Camera:Create()
    --Update the camera
    self:UpdateCamera()
    --Initial Vars
    self.entity:SetMass(1)
    self.entity:SetPhysicsMode(Entity.CharacterPhysics)
    self.pos = 0
    self.minimal_speed = -3
    self.max_speed = 3
    self.lives = 3
    self.speed = 0
    self.tilt = 0
    energy=100.0    
    energy_max=100.0
    energy_min=0
    self.energy_depletion = 0
    self.lastTime = Time:Millisecs();
    self.torch = PointLight:Create() 
end
--Adjust the camera orientation relative to the ball
function Script:UpdateCamera()
    self.camera:SetPosition(self.entity:GetPosition())
    self.camera:SetRotation(45,0,0)
    self.camera:Move(0,4,-7)
end

function Script:UpdatePhysics()
    --Get the game window
    local window = Window:GetCurrent()
end

function Script:UpdateWorld()
    --Update the camera each frame
    if energy > 0 then
        -- move if you got energy
        local move = ((window:KeyDown(Key.Up) and 1 or 0) - (window:KeyDown(Key.Down) and 1 or 0))*3
        local strafe = ((window:KeyDown(Key.Right)and 1 or 0) - (window:KeyDown(Key.Left) and 1 or 0))*3
        if window:KeyDown(Key.Up) or window:KeyDown(Key.Down) or window:KeyDown(Key.Left) or window:KeyDown(Key.Right) then
            if energy > 0 then
                if (Time:Millisecs() > self.lastTime + 80) then
                    self.lastTime = Time:Millisecs();
                    energy = energy -1
                end
            end
        end
        self.entity:SetInput(0,move,strafe)
    else 
        -- out of energy, can't move
        move = 0
        strafe = 0
        self.entity:SetInput(0,move,strafe)
    end    
    -- Light
    --light = SpotLight:Create() 
    self.torch:SetPosition(self.entity:GetPosition())
    self.torch:SetRange(0.2,1.5)
    self.torch:Move(0,1,0)
    --self.torch:
    self:UpdateCamera()
    
end

function Script:PostRender(context)
    context:SetBlendMode(Blend.Alpha)
    context:DrawText(energy,context:GetWidth()-30,4)
end

 

leadwerks.jpg

Link to comment
Share on other sites

You can collapse the model in the model editor window and this will reset the rotation to 0,0,0 and then it will work with character physics.

If you need to adjust the rotation further around the Y axis there is a character angle physics setting available in the editor for this purpose.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

9 hours ago, Josh said:

You can collapse the model in the model editor window and this will reset the rotation to 0,0,0 and then it will work with character physics.

That feature is not present under the Linux build. ?

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...