Community Forum

show i3d cube

Forum Overview >> Scripting

CategoryScripting
Created23.08.2016 11:40


Pascal Stahl (Unknown) 23.08.2016 11:49
Hello Everyone,

i created an i3d-file, which contains a cube. By following the first tutorial( https://gdn.giants-software.com/tutorial01.php) i tried to show that cube with the following piece of code:

sceneToLoad = loadI3DFile("Z:/My Games/FarmingSimulator2015/cube.i3d", true);
cubeId = getChildAt( sceneToLoad, 1)-- already tried 0 and 2 but nothing works
link(getRootNode(),cubeId)
print("this is the cubeID: ".. cubeId) -- shows me an id
setVisibility(cubeId, true)
setTranslation(cubeId, -158, 98, -319)
setScale(cubeId, 5, 5, 5)

i placed it right in front of my car but i couldn´t see it. When i started driving in that direction i wasn´t able to drive through the cube(in the first version of the cube, this one is without collision) I thought it was too small so i tried scaling it but nothing worked.

Maybe something went wrong by exporting the cube?
You can find the cube under the following link: https://www.dropbox.com/s/xyju5ix3ldli97q/cube.i3d?dl=0

can anyone help me to show this i3d file or give me a hint what the problem is?

Best regards and thanks in advance!

Emil Drefers (Unknown) 29.08.2016 07:20
Hi,

concerning the usage of getChildAt() ... the first child has the index 0.

It might help to use more 'debug prints' in your code to see what has worked succesfully


If you can't drive through a cube you should check the rigid body attributes of the object.
There are three different types: static, kinematic and dynamic
An object can have a physic attribute set, but does not have to.



Pascal Stahl (Unknown) 07.09.2016 10:47
Hey,

i use more prints but i cut them out to just show the code that does not work.
However there was no problem with the code but with my i3d File.

Thanks again for the help :-)

Best regards


Note: Log in to post. Create a new account here.