Anything to do with physics. Rigid Bodies, Kinematic controllers, vehicles etc.

Game controller

Game controller

Postby TattieBoJangle » 03 Feb 2015, 22:55

Hi can i ask how you get the game controller(xbox) to work :)
Case: CM Storm Trooper CPU: I7 5930k X99 Cooler: Noctua NH-D15 Graphics: Asus GTX 1080 Motherboard: Rampage Extreme V x99 Ram: RipJaws DDR4 3000mhz Storage: x2 SSD Crucial 500GB + x5 2TB Hdd PSU: Evga 1500w OS: Windows 10
User avatar
TattieBoJangle
Community Manager
Community Manager
 
Posts: 858
Joined: 26 Jan 2015, 00:15
Location: United Kingdom
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer
Skill: Great creative

Re: Game controller

Postby SolarPortal » 03 Feb 2015, 23:34

Just plug it in and load skyline, then script the Character, vehicle or whatever in its Microscript or scene script using these functions.

Code: Select all
---------------------------------------------------------------------------------
-- Joystick input
---------------------------------------------------------------------------------
function onJSAxisMoved(axis, value)
   if(axis==0) then
      -- Left Analogue Stick - Up and Down Movements
   end
   
   if(axis==1) then
      -- Left Analogue Stick - Left and Right Movements
   end

        sky.print("moving axis: "..axis.." : Value :"..value, 1 );
end

function onJSButtonPressed(button)
   sky.print("joystick pressing button button: "..button, 1 );
end

function onJSButtonReleased(button)
   sky.print("joystick releasing button button: "..button, 1 );
end


Unfortunately, the base presets such as FPS or vehicle do not work from joystick by default on their actions and will need scripted to get the joystick working.

I think it would be cool to have joystick on the player and cars by default. More fun to play with. :)
But there are multiple scripted examples to help you get going:

Example 1 - character movement: Royal Sorceress Preset Character.
> Move around using left analogue stick.
> Fire a fireball with the A button.

Preset File: "Asset Library\Presets\Characters\JS - Sourceress.preset"
Tech Demo: "Asset Library\Scenes\Tech Demos\Character\Full Lua Character C3 Joystick enabled.xSkyScene"

Find the player and open the micro script from the properties, look for the joystick functions listed above.

Example 2: - vehicle movement: Porsche Vehicle
This is the one you drive in the Racetrack Template which uses keyboard and joystick.
> Move using left analogue stick
> B button to boost
> Back Right Toggle to accelerate with throttle ratio.

Preset File: "Asset Library\Presets\Vehicles\porche911_Player(JS).preset"
Demo: "Asset Library\Scenes\Templates\Game Templates\03 GameTemplate RaceTrack_V1.xSkyScene".

Find the player car and open the micro script from the properties, look for the joystick functions listed above.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Physics

Who is online

Users browsing this forum: No registered users and 1 guest