Search the Community
Showing results for tags 'Controller'.
-
Hey guys, Been playing around with leadwerks lately testing random levels, trying to learn the software. However one thing I came across is the fact that for some reason I cannot fire my weapon (unless I am holding the ctrl key) when I am moving my character around with the WASD keys. I made sure it was reloaded too. I tried looking at the FPS controller script, however I do not know where I can find the specific code that seems to call for the ctrl key being depressed in order to fire my gun while moving. I want to be able to strafe around and fire my weapon at the same time without it being clunky. If I click my mouse while holding a weapon in a stationary position, the weapon fires like normal. Can someone point me in the right direction as far as scripting? I am only just starting to wrap my head around LUA in leadwerks. Thanks in advance.
-
https://youtu.be/mcJiROYmByk I made a Video for this, because it is hard to explain. The player is not rotated right with the pivot that is at the same position, the green box ( camera ) is a child of the pivot. function Script:UpdatePhysics() local move = ((window:KeyDown(Key.D) and 1 or 0) - (window:KeyDown(Key.A) and 1 or 0))*4 local strafe = ((window:KeyDown(Key.W)and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0))*4 if window:KeyDown(Key.W)then self.entity:SetInput(self.pivot:GetRotation().y ,0,0) end end
- 2 replies
-
- Player
- ThirdPerson
-
(and 1 more)
Tagged with:
-
Platform: Windows. Downloads: FPS Player scenario (Preconfigured scenario ready to play Updated 08/may/2015) https://dl.dropboxusercontent.com/u/107114506/Leadwerks/LUA%20XBOX%20360%20controller%20FPS%20Template.rar Marble game ball (Preconfigured scenario ready to play Updated 03/may/2015) https://dl.dropboxusercontent.com/u/107114506/Leadwerks/Marblegame%20XBOX360%20controller%20template.rar Only DLL: (Updated 08/may/2015) https://dl.dropboxusercontent.com/u/107114506/Leadwerks/SDL2.dll%20and%20LuaGamePad.dll.zip Note: - You must have connected the XBOX 360 controller to work. - If you want put the code in you proyect, copy and paste the "LuaGamePad.dll" and "SDL2.dll" in your project folder. ----------------------------------------------------------------------------------------------------------------------------------- New update!! Data: 08/May2015 Working hard on my free time, I developed the LUA FPS XBOX 360 controller. What's new: - The movement is now analog (Left stick). - The view is now analog (Right stick). - The sprint is now analog (Right Trigger). - The sound of the steps are automatically adjusted to the speed of the player, also considers the sprint. It is fully preconfigured and is 100% functional, I've tested with the FPS Weapons Pack and works fine. If you find a bug please send me a report. Open the project and open the "07-AI and Events.map" The "FPSPlayer XBOX360 controller adapted.lua" is in the same folder that "FPSPlayer.lua" The empty template XBOX 360 controller is in the "Scrips / objects / XBOX 360 controller" folder. Controller mapping: ----------------------------------------------------------------------------------------------------------------------------------- Data: 03/May2015 Hello everyone! I work hard to create a Lua XBOX 360 controller template. (Based on the work of Skrakle). http://www.leadwerks.com/werkspace/topic/12476-lua-lib-game-controller-support/ Upgrade Author: Daniel0213 What's new: DRIVER: I have expanded the functions and recompile the driver. I added: - The right analog stick is now functional. - The left and right trigger just happen to be digital to be analog + digital. SCRIPT: - The script is not oriented to App.lua, now is oriented to the object you want to control, the player. (You must insert the script on the object that you want to control). - I created a template fully explained with comments. - I've written and adapted the formulas needed to converter from analog value to Leadwerks. Not any knowledge of analog sensors are required to write your own program. The code gives you automatically a converted analog value. - To change analog values you do not need to enter the code can be changed quickly from outside. - Reduced the death zone of analogue sensors, but can be changed easily. The instruction have a comment. - I separate all the buttons to make it easier to interpret the code. - You can choose externally the number of controller you want to use. ------------------------------------------------------------------------------------------------------------------------------------ I inserted the code in the template marble game, for a practical example of the operation display. Within the project it is the empty template XBOX controller and inserted into the ballplayer template for a practical example. (I have asked permission to Josh to do this) The empty template XBOX 360 controller is in the "Scrips / objects / XBOX 360 controller" folder. The "ballplayer" script has been modified to insert the sample code. Changed the name to "ballplayer Adapted to XBOX 360 controller." I'm using the Leadwerks version 3.5 Beta. ------------------------------------------------------------------------------------------------------------------------- HOW INSTALL: Very simple. 1. Unzip the .rar file. 2. Copy the "XBOX360controllertemplate" folder in your Leadwerks project folder. 3. Open leadwerks, go to "project manager" Push "import" enter to "XBOX360controllertemplate" folder and select the "XBOX 360 controller template.werk" file. 4. Select the project and press "OK". You must disable the sandbox lua libraries to work xbox 360 controller. ----------------------------------------------------------------------------------------------------------------------------------- How analog sensors work: Put the desired maximum values. In this case, when the left stick reaches its peak (up direction), the analog value which will be 15. Decreasing this value progressively until it reaches 0, when you reach the death zone. Don't touch the formula. ------------------------------------------------------------------------------------------------------------------ A bit of theory: The Analog converted formula. (Don't worry, you don't have to create, it is already written in the template code.) ENJOY!!! Future upgrades: - Add left and right vibration. - Linux support. Note: If you want put the code in you proyect, copy and paste the "LuaGamePad.dll" and "SDL2.dll" in your project folder.
- 4 replies
-
- 5
-
- Controller
- sensor
- (and 4 more)
-
Hi! So, I have been looking around for a way to make a controller or gamepad work in Leadwerks, but most of the posts here seems to be outdated... Have anyone actually got this working right? Thanks! Regards, KraXarN
- 4 replies
-
- controller
- gamepad
-
(and 2 more)
Tagged with: