Jump to content

swipis

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by swipis

  1. MouseDown(3) working same as button when I hit and hold middle mouse button is working but for scrolling not.
  2. Yes its working but how to make working on mouse wheel scroll?
  3. Hello, I trying to make zoom in/out 3rd person camera, here is the code: if mouseWheelPos > 0 then if self.camDist < self.camMaxDist then self.camDist = mouseWheelPos * 1 if self.camDist > self.camMaxDist then self.camDist = self.camMaxDist numer = self.camMacDist end end elseif mouseWheelPos < 0 then if self.camDist > self.camMinDist then self.camDist = mouseWheelPos * 1 if self.camDist < self.camMinDist then self.camDist = self.camMinDist number = self.camMinDist end end end System:Print(tostring(self.camDist)) self.cam:SetPosition(Vec3(0, -self.camDist, 0)) I can say its kinda working, but need make more smoother, any tips?
  4. Hello! I have some problem, here is the code Script.camPivot = "" --entity "Pivot" Script.mx = 0 Script.my = 0 Script.prevmx =0 Script.prevmy = 0 Script.toggle = 0 Script.window = Window:GetCurrent() function Script:UpdateWorld() if window:MouseHit(Key.RButton) then toggle = 1 end if window:MouseDown(Key.RButton) then mousePos = window:GetMousePosition() mx = self.camPivot.GetRotation().x + (mousePos.y - prevmy) my = self.camPivot.GetRotation().y + (mousePos.x - prevmx) if toggle == 1 then toggle = 0 mx = self.camPivot.GetRotation().x my = self.camPivot.GetRotation().y end self.camPivot:SetRotation(mx, my, self.camPivot:GetRotation().z) prevmx = mousePos.x prevmy = mousePos.y end end when I start game and press mouse button I getting error message: error in function 'GetRotation', argument #1 is [no object; Entity expected]. here is how looks scene: what is wrong here? Thank you
  5. If I put self.Pivot:GetRotation() I will get "pivot rotation: userdata:0x0103fa58" in Output.
  6. Hello there! I trying to make camera movement, Scene looks like root>Player>pivot>Camera. here is the script: Script.Pivot = "" --entity "Pivot" function Script:UpdateWorld() print(Pivot:GetRotation()) end It should print pivot rotation, but Im getting "attempt to index global "Pivot" (a nil value)". Can someone explain what is wrong here? Thank you
  7. yes pivot is players child, what I want to do is make look around player like in the video below (this is my unity project) and code line you gave not helping I found this link but here is very outdated.
  8. heya! I trying to make a camera rotating around the player. if window:MouseDown(Key.RButton) then window:HideMouse() self.currentMousePos = window:GetMousePosition() 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) --Set the camera angle self.entity:SetRotation(self.camRotation + self.pivot:GetPosition()) else window:ShowMouse() end this code taken from FPS script. what I should do to rotate around player? thanks
  9. Heya! So I replaced cube to other figure as player and now when I want to test its show black screen for few second and turn off. No code changes, physics and scripts is set up. looks like camera script not finding new player. any help? Thank you Edit: looks like something wrong with new "player" (made with blender), put another figure and its working.
  10. Looks like Entity:SetPickMode() not working for me
  11. ok, I will look at this solution tomorrow. thank you
  12. ok, I will try to explain what I looking for . so what I trying to get - there are space and cube are in space so when I click left mouse button on empty space I need that cube start flying to that point where I clicked. so I think I need cast ray from the cube. this code will work (i think) just one problem cube blocking ray if I click on him.
  13. looks like this code should work if window:MouseDown(Key.LButton) then local pickinfo = PickInfo() local p = window:GetMousePosition() if (self.camera:Pick(p.x,p.y,pickinfo,pickradius,true)) then self.picksphere:Show() self.picksphere:SetPosition(pickinfo.position) end end but in this code (if I understand correctly) ray casting from camera to the 'wall', but I need cast from the player. any help?
  14. Hello guys! I need some help with raycasting. scene is very simple have cube (player) and the wall (player is set to Character collision type and wall is set to debris). down bellow scene picture. Here is the code if window:MouseDown(Key.LButton) then local pickInfo = PickInfo() local point1 = self.entity:GetPosition() local point2 = self.rayWall:GetPosition()--Transform:Point(0,0,1000, self.rayWall,nil) if self.entity.world:Pick(point1, point2, pickInfo, 0, true, Collision.Prop) then System:Print("Picked!!!") end end so there are problem in output 'Picked!!!' should come up when ray hits the wall, but 'Picked!!' comes when I click anywhere. P.S.I'am new at this game engine and LUA scripting. And not sure how raycasting works. Thanks
  15. Thank you AggrorJorn for your tutorials and your answer!
  16. ok, I doing tutorial and now I got an error "attempt to index field 'context'(a nil value)" in Start function here is the code Script.itemSlots = 4 --int "Item Slots" Script.itemSize = Vec2(64,64) --Vec2 "Item Size" Script.offset = 8.0 --float "Offset" Script.items = {} Script.screenWidth = 0 function Script:Start() self.screenWidth = App.context:GetWidth() end function Script:PostRender(context) for i = 1, self.itemSlots, 1 do context:SetColor(1,1,1,1) local x = self.screenWidth - self.itemSize.x local y = (i * self.itemSize.y) + (i * self.offset) context:DrawRect(x, y, self.itemSize.x, self.itemSize.y) end end please help
  17. ok thank you, I will try later
  18. on steam version when started EnableLegacyFeatures value goes back to 0.
  19. thank you but that tutorial not very clear, maybe someone can explain how and what to do sorry but yes Iam noob with Leadwerks. Ohh atm I doing your tutorial AggrorJorn! well done! Thank you
  20. thank you for your reply but it seems in that tut creating cubemap from one image. if you know how making skybox in unity you should understand that I have 6 images which creating 1 skybox.
  21. Hello guys! I have a question about creating custom skybox'es. so I know there are a tutorial how to make a skybox, but what if I have 6 skybox images (used in unity to make skybox) and possible somehow to make skybox from these images in Leadwerks?
×
×
  • Create New...