Tomas
-
Posts
40 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Tomas
-
-
Cool. Thanks alot Genebris
-
Hi, does leadwerks has mousewheel functions? Cant find any..
-
Thanks macklebee for your help. Code works now.
- 1
-
Thanks for reply. I tried the code, downloaded the shader, but it didnt worked for me as it should. Dont know why, but the shader wouldnt load into engine. I copied the shader contents into "drawimage.shader" that comes with engine, and then it worked. Theres my code:
Script.Tx = Texture:Load("Materials/Compass/compass.tex") function Script:Start() self.camera = Camera:Create() self.camera:SetRotation(self.entity:GetRotation(true)) self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,1.8,0)) self.imageshader = Shader:Load("Shaders/Drawing/drawimage.shader") end function Script:PostRender() local context=Context:GetCurrent() context:SetShader(imageshader) self.imageshader:SetVec2("pivotposition", Vec2(100.0,100.0)) self.imageshader:SetFloat("angle",45) local rot=Vec3() rot=self.entity:GetRotation(true) --context:SetRotation(rot.y) context:DrawImage(self.Tx,100,100,200,200) context:DrawLine(100,100,200,200) end
Any ideas what could be wrong?
-
How i can rotate 2d image? I have this code, but it rotates viewport not image.
Script.Tx = Texture:Load("Materials/Compass/compass.tex") function Script:Start() self.camera = Camera:Create() self.camera:SetRotation(self.entity:GetRotation(true)) self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,1.8,0)) end function Script:PostRender() local context=Context:GetCurrent() local rot=Vec3() rot=self.entity:GetRotation(true) context:SetRotation(rot.y) context:DrawImage(self.Tx,100,100,10,100) end
-
...figured out. Need to use 2d code in function Script:PostRender:
function Script:PostRender() local context=Context:GetCurrent() context:SetColor(0,1,0) context:DrawRect(0,0,100,100) end
Thanks for help
-
function Script:Start() self.camera = Camera:Create() self.camera:SetRotation(self.entity:GetRotation(true)) self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,1.8,0)) end function Script:UpdateWorld() local context=Context:GetCurrent() context:SetColor(0,0,0) context:Clear() context:SetColor(0,1,0) context:DrawRect(0,0,100,100) context:Sync() end
When i use this 3d view is gone. How to combine 2d and 3d?
-
Hi. Im wandering is there any 2d functions built in the engine. I want to create a hud, cant find any 2d drawing functions, or maybe there are other ways to display huds (GUI's)?
-
At last i have water. Thanks verry much guys for advices.
-
Hi, is there any water creation tutorial? I have water shader supplied with engine, tried to attach it to plane and it didnt worked for me. Also i downloaded "Inexpensive water" from workshop. Also no sucess. Can someone advice me how to use it.
-
Well,i finally got the answer to my problem. Its here http://www.leadwerks.com/werkspace/page/documentation/_/entity/entitysetinput-r706 . Thanks everyone for help. Some physics functions dont work if character controller physics mode is used, but with that function i have what i need. Thanks again
-
This is my code. Entity is not moving at all even with friction 0. Entity has collision box and shape box.
Script.camPos=Vec3() Script.entPos=Vec3() Script.camRotation=Vec3() Script.mouseSensitivity = 15 Script.mouseDifference=Vec2() Script.mouseOld=Vec2() Script.currentMousePos=Vec2() Script.mousepos=Vec2(0,0) function Script:Start() local window = Window:GetCurrent() local context = Context:GetCurrent() self.camera = Camera:Create() self:UpdateCamera() self.entity:SetFriction(1,1) end function Script:UpdateCamera() local context = Context:GetCurrent() local window = Window:GetCurrent() self.currentMousePos = window:GetMousePosition() window:SetMousePosition(Math:Round(context:GetWidth()/2), Math:Round(context:GetHeight()/2)) self.currentMousePos.x = Math:Round(self.currentMousePos.x) self.currentMousePos.y = Math:Round(self.currentMousePos.y) self.mouseDifference.x = Math:Curve(self.currentMousePos.x - Math:Round(context:GetWidth()/2),self.mouseDifference.x,3) self.mouseDifference.y = Math:Curve(self.currentMousePos.y - Math:Round(context:GetHeight()/2),self.mouseDifference.y,3) self.camRotation.x = Math:Clamp(self.camRotation.x + self.mouseDifference.y / self.mouseSensitivity,-90,90) self.camRotation.y = self.camRotation.y + (self.mouseDifference.x / self.mouseSensitivity) self.camera:SetRotation(self.camRotation) self.entPos=self.entity:GetPosition() self.camera:SetPosition(self.entPos.x,self.entPos.y+1.8,self.entPos.z) self.entity:SetRotation(0,self.camRotation.y,0) end function Script:UpdateWorld() self:UpdateCamera() end function Script:UpdatePhysics() --Get the game window local window = Window:GetCurrent() self.entity:SetFriction(1,1) if window:KeyDown(Key.W) then self.entity:SetVelocity(0,0,10,false) end --if window:KeyDown(Key.W) then self.entity:AddForce(0,0,10,false) end --if window:KeyDown(Key.A) then self.entity:AddForce(-speed,0,0,false) end --if window:KeyDown(Key.D) then self.entity:AddForce(speed,0,0,false) end --if window:KeyDown(Key.S) then self.entity:AddForce(0,0,-speed,false) end end
-
Im adding in update physics. I tried friction but cant see any difference between 0 and 1. Tried different values. How i can add velocity? Can you give me example, im not sure how to use it...? Sorry for being newbish...
-
Hi, my entity has a mass of 10 and im trying to move it slow. I use (...if window:KeyDown(Key.W) then self.entity:AddForce(0,0,10,false) end) but entity moves too fast. Reducing force less than 10 will make entity immovable. How i can reduce the speed of entity?
Is it possible to have multiple viewports?
in Programming
Posted
Hi, wonder is it possible to have multiple viewports?