Jump to content

swipis

Members
  • Posts

    28
  • Joined

  • Last visited

swipis's Achievements

Newbie

Newbie (1/14)

0

Reputation

  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?
×
×
  • Create New...