Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

Empty scene

All about the StoneScript

Empty scene

Postby kapinezi » 25 Jul 2007, 08:24

Hi folks,

I'm trying to make a veeeeery simple scene. A box, a light pointing on the box and a camera. Probleme is: when I edit the scene everything seems OK but when I try to run it, it's empty. Not black, but grey with a line in the middle as if it was the floor grid seen from the camera on the floor. :(

I think I've done everything. Light is white, camera is declared in game/general and points in the right direction, according to the log, the scene is loaded correctly and there is no problem.

Did one of you already seen that sort of things?
User avatar
kapinezi
Platinum Boarder
Platinum Boarder
 
Posts: 472
Location: DullKarbonCity

Re:Empty scene

Postby NiCoX » 25 Jul 2007, 16:46

Hi,

What happens is normal. I explain :

When the Game starts, it creates an instance of the Camera Model you have referenced in the "Main User Camera", in the GameEditor. This Object (the Camera) is by default the active one (because it is conceptually the default "eyes" of the user/player). And by default, it is placed at the origin of the Scene, looking to the -Z axis.

What you see is the grid of the Scene :).

Solution 1 : remove the "Main User Camera" in the GameEditor, forcing the Engine to take the Scene active Camera as default.

Solution 2 : create an AIModel of camera that will place it somewhere, and assign it to your Camera Model.

Solution 3 : in your main AIModel "onInit" Script, put those lines of code :

Code: Select all
local hCamera = application.getCurrentUserActiveCamera ( )
if  ( hCamera ~= nil )
then
    object.setTranslation ( hCamera, 100, 100, 100, object.kGlobalSpace )
    object.lookAt         ( hCamera,   0,   0,   0, object.kGlobalSpace, 1 )
end
<br><br>Post edited by: NiCoX, at: 2007/07/25 18:48
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5627
Location: France


Return to Game programming