
function onInit( objID)
obj = objID;
-- Where code used to be
end
function postInit()
-- | Call code here.
end
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.
Users browsing this forum: No registered users and 2 guests