Jump to content
  • 0
Braqoon

Wrong position of imported object.

Question

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

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 0

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.

Share this post


Link to post
  • 0
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. 🙃

Share this post


Link to post
  • 0

Ouch, yeah that option is not available on Linux Build 4.5. Any other suggestions ? Trying to set Rotation in general settings makes no difference.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

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

×
×
  • Create New...