Skyline Editor related tips n tricks!

Errors on 1st play in editor [SOLVED]

Errors on 1st play in editor [SOLVED]

Postby CreativeOcclusion » 18 Jan 2016, 21:01

I start SkyLine....Open my scene....Wait for loading process...press play in the editor...I get a whole list of "bodyID does not exist"...I stop the game and press play again....No Errors at all...I am having to use the physics.setPosition() a lot to move the physics along with the models...The game will play fine on the first load...But there must be an error in the engine on the initial checks...I would like to be able to set physics to kinematic and physics automatically follow model...a suggestion
Image
Last edited by CreativeOcclusion on 21 Mar 2016, 07:24, edited 1 time in total.
Thanks, CreativeOcclusion
User avatar
CreativeOcclusion
Skyline Warrior
 
Posts: 366
Joined: 22 Jun 2015, 19:34
Location: Texas

Re: Errors on 1st play in editor

Postby CreativeOcclusion » 19 Jan 2016, 20:18

I thought I would post again on this topic to move it into the new posts...I just want to find out if it's something I'm doing wrong or if it is a bug in the engine....Thanks
Thanks, CreativeOcclusion
User avatar
CreativeOcclusion
Skyline Warrior
 
Posts: 366
Joined: 22 Jun 2015, 19:34
Location: Texas

Re: Errors on 1st play in editor

Postby SolarPortal » 19 Jan 2016, 20:33

It could be due to the onInit being called before the physics is created. Whatever scripts are failing, try moving their code into the postInit like this.

Code: Select all

function onInit( objID)
    obj = objID;

    -- Where code used to be
end

function postInit()
    -- | Call code here.
end


This error is caused when you are using or grabbing the bodyID before the physics has engaged for the engine.
e.g. if you add a physics, then add a script. Using the bodyID in the onInit will work.
If you add the script action and then add the physics, you have to the postInit() as the script onInit is called before the physics onInit().

PostInit() is designed to run directly after all entity actions have been initialised so data is accurate and accessible.

This is what i believe this problem is.
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

Re: Errors on 1st play in editor

Postby CreativeOcclusion » 19 Jan 2016, 20:43

SolarPortal wrote:It could be due to the onInit being called before the physics is created. Whatever scripts are failing, try moving their code into the postInit like this.

Code: Select all

function onInit( objID)
    obj = objID;

    -- Where code used to be
end

function postInit()
    -- | Call code here.
end


This error is caused when you are using or grabbing the bodyID before the physics has engaged for the engine.
e.g. if you add a physics, then add a script. Using the bodyID in the onInit will work.
If you add the script action and then add the physics, you have to the postInit() as the script onInit is called before the physics onInit().

PostInit() is designed to run directly after all entity actions have been initialised so data is accurate and accessible.

This is what i believe this problem is.


I will try this...What is weird is it only does it on the first run after opening SkyLine...It seems like it would do it every time game is ran....Thanks for the help...
Thanks, CreativeOcclusion
User avatar
CreativeOcclusion
Skyline Warrior
 
Posts: 366
Joined: 22 Jun 2015, 19:34
Location: Texas

Re: Errors on 1st play in editor [SOLVED]

Postby CreativeOcclusion » 21 Mar 2016, 07:23

Thank you for the help...By using the postInit() function when getting all the physics bodies, all errors were removed...It did take a while to go through all the scripts...But it was worth it... :D :D
Thanks, CreativeOcclusion
User avatar
CreativeOcclusion
Skyline Warrior
 
Posts: 366
Joined: 22 Jun 2015, 19:34
Location: Texas

Re: Errors on 1st play in editor [SOLVED]

Postby SolarPortal » 21 Mar 2016, 11:45

excellent, well done m8 :)
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 Skyline Editor

Who is online

Users browsing this forum: No registered users and 6 guests

cron