Jump to content

[SOLVED] - U3D - BabylonJS Game Editor Toolkit


MackeyK24
 Share

Recommended Posts

1 minute ago, MackeyK24 said:

Ahhh... Windows... I will check out on windows... But your right... Closing tabs (Scene, Game AND ASSET STORE) will clear out and reset... There is a piece of code... ExporterWindow.OnEnable (every time we first active the Scene Exporter... We 'hook' into the Asset Store Window... That may be the issue we have to fix on window)... Again i will take a look at.

BTW... Please DOWNLOAD a new Toolkit Package (some minor texture fixes using unsupported files type like .ps and.tiff ... when it has to grab the pixel data for the unsupported file types...should work fine now)

Also.. Please check out the latest "Keep Project Up To Date" video to keep your libraries (most importantly the Managed Scene component api that i will continue to add Unity-Like features to)

Yes I saw that feature is great way to keep the version updated. great, I'm going recreate the things you did on the videos and I will post back my results.

Link to comment
Share on other sites

On 12/18/2016 at 2:32 AM, MrVR said:

OMG... Merry Christmas to us :D @MackeyK24 ... Good luck with your projects, my offer still there if you need it.

Thank you so much for working hard on this I hope is release soon @Deltakosh.. congrats guys you are awesome !!!

Here is a little time line menu help for the video

- Minute 00:00 Toolkit Setup

- Minute 03:20 Editor windows Setup

- Minute 07:30 Web Server Start

- Minute 09:00 Enabling User input

- Minute 16:00 Camera Component 

- Minute 20:00 Camera Component User Input

- Minute 28:00 Mesh Component

- Minute 33:30 Light Component 

 

 

 

 

UPDATE

Regarding the Web Server Start... I forgot i put a button (under Export & Preview) that will start your web server if not already started...NO NEED TO CLOSE TAB or RESTART UNITY for the web server... It was there the WHOLE TIME :)

 

Link to comment
Share on other sites

4 minutes ago, MackeyK24 said:

 

UPDATE

Regarding the Web Server Start... I forgot i put a button (under Export & Preview) that will start your web server if not already started...NO NEED TO CLOSE TAB or RESTART UNITY for the web server... It was there the WHOLE TIME :)

 

OK yes I forgot to mention that I had issues when exporting cause the web-server did not start but I use the button then it work

serverstart.JPG

Link to comment
Share on other sites

@MrVR I see the issue on Windows (although i only got 2 window errors in console AND DID NOT have to close any tabs). It doesn't seem to like something in the window init ONLY when selecting the BabylonJS Editor Toolkit at project creation using "Add Asset Package".  This seems to ONLY be a problem on Windows.

As an alternative... Just DONT add BabylonJS Editor Toolkit at Project creation ON WINDOWS... IF you have problems...

Once you create the unity project (Without selecting toolkit)... You can simple use: Assets->Import Package... And Select the BabylonJS Editor Toolkit.unitypackage ... Works Smooth That Way... No Errors :)

 

Link to comment
Share on other sites

3 hours ago, MackeyK24 said:

@MrVR I see the issue on Windows (although i only got 2 window errors in console AND DID NOT have to close any tabs). It doesn't seem to like something in the window init ONLY when selecting the BabylonJS Editor Toolkit at project creation using "Add Asset Package".  This seems to ONLY be a problem on Windows.

As an alternative... Just DONT add BabylonJS Editor Toolkit at Project creation ON WINDOWS... IF you have problems...

Once you create the unity project (Without selecting toolkit)... You can simple use: Assets->Import Package... And Select the BabylonJS Editor Toolkit.unitypackage ... Works Smooth That Way... No Errors :)

 

Nice I will try that, so far I was able to clean all error its all working fine as the videos you post, today I

- Make the cube rotate with the Mesh controller,

- Dim the light with a light controller  controller using different light factors to change the intensity 

- Attached particles to the cube they work amazing see image blelow

- Camera controller works but is not accurate when I use my game-pad STRATUS XL SteelSeries game-pad,  I guess I have to create a class to maps all the axis input from the controller.

 

particules.PNG

FOR TOMORROW 

- I will test other features such as light baking , flare system, terrain export. etc.

- then I will try to export some characters I have already rigged with animations and figure how to make them work in Babylon, I have a c# class to move a shark I will play with this tomorrow 

using UnityEngine;
using System.Collections;

public class SharkMovement : MonoBehaviour
{
	private float m_moveSpeed = 5.0f;
	private float n_moveSpeed = 30f;
	private float moveSpeed = 0.5f;
	
	 private Animator animator;
	void Start()
	{
		animator = this.GetComponent<Animator>();
	}
	
	void Update ()
	{
		
		if (Input.GetKey("i"))
		{
			moveFast();
		}
		else if (Input.GetKey("j"))
		{
			moveLeft();
		}
		else if (Input.GetKey("l"))
		{
			moveRight();
		}
		else if (Input.GetKey("o"))
		{
			moveUp();
		}
		else if (Input.GetKey("p"))
		{
			moveDown();
		}
		else if (Input.GetKey("k"))
		{
			moveAttack1();
		}
		else if (Input.GetKey("m"))
		{
			moveAttack2();
		}
		else if (Input.GetKey("n"))
		{
			moveAttack3();
		}
		else 
		{
			moveSlow();
		}
		
	}

	public void moveFast()
	{
		transform.Translate(0.0f, 0.0f, +m_moveSpeed * Time.deltaTime);
		{
			animator.CrossFade("FastSwim", 0.2f);
		}
	}
	public void moveSlow()
	{
		transform.Translate(0.0f, 0.0f, moveSpeed * Time.deltaTime);
		{
			animator.CrossFade("SlowSwim", 0.2f);
		}
	}
	public void moveRight()
	{
		transform.RotateAround(transform.position+(transform.right*2), Vector3.up, Time.deltaTime * n_moveSpeed);
		{
			animator.CrossFade("RT", 0.2f);
		}
	}
	public void moveLeft()
	{
		transform.RotateAround(transform.position-(transform.right*2), Vector3.down, Time.deltaTime * n_moveSpeed);
		{
			animator.CrossFade("LT", 0.2f);
		}
	}
	public void moveUp()
	{
		transform.Rotate (Vector3.right * Time.deltaTime * -m_moveSpeed);
		{
			animator.CrossFade("DiveOut", 0.2f);
		}
	}
	public void moveDown()
	{
		transform.Rotate (Vector3.left * Time.deltaTime * -m_moveSpeed);
		{
			animator.CrossFade("DiveIn", 0.2f);
		}
	}
	public void moveAttack1()
	{
		transform.Translate(0.0f, 0.0f, +m_moveSpeed * Time.deltaTime);
		{
			animator.CrossFade("Attack1", 0.2f);
		}
	}
	public void moveAttack2()
	{
		transform.Translate(0.0f, 0.0f, +m_moveSpeed * Time.deltaTime);
		{
			animator.CrossFade("Attack2", 0.2f);
		}
	}
	public void moveAttack3()
	{
		transform.Translate(0.0f, 0.0f, +m_moveSpeed * Time.deltaTime);
		{
			animator.CrossFade("Attack3", 0.2f);
		}
	}
	
}

 

 

HERE is a VR version for the phone using the particles on the box I have to put the libraries (cannon, physics, etc) on my distribution copy. but I will test more tomorrow  

Link to comment
Share on other sites

@MrVR Nice... Before you start light mapping ... Grab the latest toolkit (at least #1603) has fixes for Unity 5.5 TextureImporterType.Lightmap.

 

Regarding Gamepad... Actually BabylonJS only support TWO gamepad types (A Generic Gamepad and Xbox360). The generic class does not have the trigger and directional pad support (you have to manually get ANY button or axis state). The Xbox class has certain Button and Axis schema it looks for (i added a mapping in the babylon.gamepad.ts to support XboxOne controllers as well).

So if your controller DOES NOT identify ITSELF as Xbox 360 or Xbox One controller (gamepad.id string) it will only map to the generic pad (babylon.gamepad.ts):

private _addNewGamepad(gamepad): Gamepad {
    if (!this.oneGamepadConnected) {
        this.oneGamepadConnected = true;
        if (Gamepads.gamepadDOMInfo) {
            document.body.removeChild(Gamepads.gamepadDOMInfo);
            Gamepads.gamepadDOMInfo = null;
        }
    }

    var newGamepad;
    var xboxOne: boolean = ((<string>gamepad.id).search("Xbox One") !== -1);
    if (xboxOne || (<string>gamepad.id).search("Xbox 360") !== -1 || (<string>gamepad.id).search("xinput") !== -1) {
        newGamepad = new Xbox360Pad(gamepad.id, gamepad.index, gamepad, xboxOne);
    }
    else {
        newGamepad = new GenericPad(gamepad.id, gamepad.index, gamepad);
    }
    this.babylonGamepads.push(newGamepad);
    return newGamepad;
}

 

Reading button mapping... If you can use the driver of your controller to EMULATE to at least Button map to an Xbox 360 controller (with Xbox 360 in its ID)... Otherwise you are going to have to manually use the Generic Gamepad Class. Here are the button values (I tweaked to allow Xbox One button as well).

You could use this as guild to create your own STRATUS XL gamepad support:

public update() {
    super.update();
    if (this._isXboxOnePad) {
        this.buttonA = this.browserGamepad.buttons[0].value;
        this.buttonB = this.browserGamepad.buttons[1].value;
        this.buttonX = this.browserGamepad.buttons[2].value;
        this.buttonY = this.browserGamepad.buttons[3].value;
        this.buttonLB = this.browserGamepad.buttons[4].value;
        this.buttonRB = this.browserGamepad.buttons[5].value;
        this.leftTrigger = this.browserGamepad.axes[2];
        this.rightTrigger = this.browserGamepad.axes[5];
        this.buttonBack = this.browserGamepad.buttons[9].value;
        this.buttonStart = this.browserGamepad.buttons[8].value;
        this.buttonLeftStick = this.browserGamepad.buttons[6].value;
        this.buttonRightStick = this.browserGamepad.buttons[7].value;
        this.dPadUp = this.browserGamepad.buttons[11].value;
        this.dPadDown = this.browserGamepad.buttons[12].value;
        this.dPadLeft = this.browserGamepad.buttons[13].value;
        this.dPadRight = this.browserGamepad.buttons[14].value;
    } else {
        this.buttonA = this.browserGamepad.buttons[0].value;
        this.buttonB = this.browserGamepad.buttons[1].value;
        this.buttonX = this.browserGamepad.buttons[2].value;
        this.buttonY = this.browserGamepad.buttons[3].value;
        this.buttonLB = this.browserGamepad.buttons[4].value;
        this.buttonRB = this.browserGamepad.buttons[5].value;
        this.leftTrigger = this.browserGamepad.buttons[6].value;
        this.rightTrigger = this.browserGamepad.buttons[7].value;
        this.buttonBack = this.browserGamepad.buttons[8].value;
        this.buttonStart = this.browserGamepad.buttons[9].value;
        this.buttonLeftStick = this.browserGamepad.buttons[10].value;
        this.buttonRightStick = this.browserGamepad.buttons[11].value;
        this.dPadUp = this.browserGamepad.buttons[12].value;
        this.dPadDown = this.browserGamepad.buttons[13].value;
        this.dPadLeft = this.browserGamepad.buttons[14].value;
        this.dPadRight = this.browserGamepad.buttons[15].value;
    }
}

Note: this.browserGamepad is the underlying HTML5 Gamepad API object.

Link to comment
Share on other sites

3 hours ago, MackeyK24 said:

 

@MrVR Nice... Before you start light mapping ... Grab the latest toolkit (at least #1603) has fixes for Unity 5.5 TextureImporterType.Lightmap.

 

Regarding Gamepad... Actually BabylonJS only support TWO gamepad types (A Generic Gamepad and Xbox360). The generic class does not have the trigger and directional pad support (you have to manually get ANY button or axis state). The Xbox class has certain Button and Axis schema it looks for (i added a mapping in the babylon.gamepad.ts to support XboxOne controllers as well).

So if your controller DOES NOT identify ITSELF as Xbox 360 or Xbox One controller (gamepad.id string) it will only map to the generic pad (babylon.gamepad.ts):

 

Awesome @MackeyK24 , I will get the new version in a few hours to start the baking test.

 

For the controller support I can detect all the inputs in the HTML5-Game-Pad website for testing game-pads, maybe this way is easier to map the user input

 below is an image took when I press  almost all the buttons on my game pad.

StartusConrtoller.PNG

Maybe I can use this class   I found at the babylon.d.ts to map all the inputs.

 

 class Xbox360Pad extends Gamepad {
        private _leftTrigger;
        private _rightTrigger;
        private _onlefttriggerchanged;
        private _onrighttriggerchanged;
        private _onbuttondown;
        private _onbuttonup;
        private _ondpaddown;
        private _ondpadup;
        private _buttonA;
        private _buttonB;
        private _buttonX;
        private _buttonY;
        private _buttonBack;
        private _buttonStart;
        private _buttonLB;
        private _buttonRB;
        private _buttonLeftStick;
        private _buttonRightStick;
        private _dPadUp;
        private _dPadDown;
        private _dPadLeft;
        private _dPadRight;
        private _isXboxOnePad;
        constructor(id: string, index: number, gamepad: any, xboxOne?: boolean);
        onlefttriggerchanged(callback: (value: number) => void): void;
        onrighttriggerchanged(callback: (value: number) => void): void;
        leftTrigger: number;
        rightTrigger: number;
        onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
        onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
        ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
        ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
        private _setButtonValue(newValue, currentValue, buttonType);
        private _setDPadValue(newValue, currentValue, buttonType);
        buttonA: number;
        buttonB: number;
        buttonX: number;
        buttonY: number;
        buttonStart: number;
        buttonBack: number;
        buttonLB: number;
        buttonRB: number;
        buttonLeftStick: number;
        buttonRightStick: number;
        dPadUp: number;
        dPadDown: number;
        dPadLeft: number;
        dPadRight: number;
        update(): void;
    }
}

 

 

Link to comment
Share on other sites

You can copy the babylon.gamepad.ts... Add your "SteelSeries Stratus XL" to the id check:

 

var newGamepad;

var stratusXL: boolean = ((<string>gamepad.id).search("Stratus XL") !== -1);

var xboxOne: boolean = ((<string>gamepad.id).search("Xbox One") !== -1);

if (stratusXL || xboxOne || (<string>gamepad.id).search("Xbox 360") !== -1 || (<string>gamepad.id).search("xinput") !== -1) {

newGamepad = new Xbox360Pad(gamepad.id, gamepad.index, gamepad, xboxOne);

} else {

newGamepad = new GenericPad(gamepad.id, gamepad.index, gamepad)

 }

... TWEAK THE LINES THAT "XBOX ONE" thats were i added support for Xbox One Controllers... In the update simply copy one of the if branches and change all your button and axis according the the output from hml5gamepad.com (That is exactly how i did it)

Actually... just take a look at babylon.gamepad.ts... EVERY place you see "Xbox One" ... you make an implementation for "Stratus XL" :)

 

Link to comment
Share on other sites

3 hours ago, Deltakosh said:

SOrry to be the one that keeps saying this but we really need a doc for newcomer in doc.babylonjs.com. You can also add reference there to your great videos

I Agree @Deltakosh is a lot of features to be covered

@MackeyK24 About the game-pad, I will test tonight at home cause my work computer dont have Bluetooth for my controller I have to get an adapter. but  will create the support for the game pad Stratus XL

For the docs and videos Im going over the API video, I wish I can put time editing it but for now I can provide a time line, (working in progress ), from the video so we can navigate easy where you talk about different features while the documentation is build.

I was working this morning with the particles system and I get this error every time I change something in the script component for the the particle system I have to add the texture for the flare again every time something change.

I will create another projects to test and make sure I get this error every-time or not any ways just changing the particle image fix it for now

UnauthorizedAccessException: Access to the path "Assets/Resources/Optical Flares Textures/Elements/Light_Glass.png" or "C:/Users/cvega.BI/Desktop/MACKEY24/MACKEY24/Mackey24/Project/Scenes\Light_Glass.png" is denied.ErrorParticuleSyst.JPG

 

Then When I try to do the update for the libraries I get this error warning 

Failed to download: https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/cannon.js - Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
UnityEngine.Debug:LogWarning(Object)
Unity3D2Babylon.Tools:DownloadFile(String, String) (at Assets/Babylon/Source/Tools.cs:250)
Unity3D2Babylon.ExporterWindow:InitUpdate() (at Assets/Babylon/Source/ExporterWindow.cs:124)

 

I debugged a little bit and I get this message from VSudio2015

"System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a\r\n  at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0 \r\n  at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0 \r\n  at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0 \r\n  at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()\r\n  at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0 \r\n  at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 \r\n  --- End of inner exception stack trace ---\r\n  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 \r\n  --- End of inner exception stack trace ---\r\n  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 \r\n  at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0 \r\n  at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0 \r\n  at System.Net.WebClient.DownloadFileCore (System.Uri address, System.String fileName, System.Object userToken) [0x00000] in <filename unknown>:0 \r\n  at System.Net.WebClient.DownloadFile (System.Uri address, System.String fileName) [0x00000] in <filename unknown>:0 "

erroUpdatingLibraries.JPG

Link to comment
Share on other sites

2 hours ago, MrVR said:

Failed to download: https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/cannon.js - Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
UnityEngine.Debug:LogWarning(Object)
Unity3D2Babylon.Tools:DownloadFile(String, String) (at Assets/Babylon/Source/Tools.cs:250)
Unity3D2Babylon.ExporterWindow:InitUpdate() (at Assets/Babylon/Source/ExporterWindow.cs:124)

Try this:

ExporterWindow.OnInitialize:

public void OnInitialize()
{
     Tools.EnableRemoteCertificates();
}

 

Then add this to Tools help class:

 

public static void EnableRemoteCertificates()
{
    System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
}

 

See if that works... Let me know... Ill add to toolkit :)

 

 

Link to comment
Share on other sites

27 minutes ago, MackeyK24 said:

Try this:

ExporterWindow.OnInitialize:


public void OnInitialize()
{
     Tools.EnableRemoteCertificates();
}

 

Then add this to Tools help class:

 


public static void EnableRemoteCertificates()
{
    System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
}

 

See if that works... Let me know... Ill add to toolkit :)

 

 

It worked :D

I added your code and I call it in the initUpdate() function with this  Tools.EnableRemoteCertificates();

 [MenuItem("BabylonJS/Update Libraries", false, 2)]
        public static void InitUpdate()
        {
            Tools.EnableRemoteCertificates();

            string prodVersion = ExporterWindow.exportationOptions.ProductionVersion.ToString();
            if (prodVersion.IndexOf(".", StringComparison.OrdinalIgnoreCase) < 0)
            {
                prodVersion += ".0";
            }
          ......

 

Link to comment
Share on other sites

@chloridrik  Looks like you don't have any lights... May just an ambient lighting...

For baking... Set your light to MIXED to keep your baking light in the scene...

The theory is... you can use AS MANY baking lights (Light set to 'BAKED') you need to produced good shadows (including area lights).

At runtime you DONT NEED as many lights.. But for the LIGHTS you want stay in the scene... Like your main light (whether your using runtime shadow map or not) set to MIXED.

Give that a shot :)

EDIT:  Also... make sure you have at least #1603 - Unity 5.5 Lighting Updates version of the toolkit from github

 

Link to comment
Share on other sites

thank you @MackeyK24 it's better with my single directional light in mixed.

I have tested with Coordinates Index 0 and 1, but the result is very different than the unity lightmapping.

If you want you can test with this free scene : https://www.assetstore.unity3d.com/en/#!/content/65679
I have fixed a bug in the exporter to export this scene : https://github.com/BabylonJS/Babylon.js/pull/1618

thx,
Jeremie.

Capture d’écran 2016-12-21 à 16.33.57.png

Capture d’écran 2016-12-21 à 16.46.09.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...