Jump to content

LE.Net error when loading scene


andy_s
 Share

Recommended Posts

I have a problem loading scenes. I get the error stating that LE.NET can't open scripts/class.

I have the complete scripts folder from the sdk in my project. I use the latest LE.NET.

 

Here is the c# code I use:

 

namespace Loading_Scene_NET

{

class Loading_Scene_NET

{

private const int ScreenWidth = 1024;

private const int ScreenHeight = 768;

private const string MediaDir = "D:/Leadwerks_Projects/Loading_Scene_NET";

private const string AppTitle = "Loading_Scene_NET";

 

static void ErrOut( string message )

{

Console.WriteLine( message );

}

 

static void Main(string[] args)

{

try

{

// Initialize

LE.Initialize();

LE.SetAppTitle(AppTitle);

LE.RegisterAbstractPath(MediaDir);

 

// Set graphics mode

if( LE.Graphics(ScreenWidth,ScreenHeight) == 0 )

{

ErrOut( "Failed to set graphics mode." );

return;

}

 

 

// Create framework object and set it to a global object so other scripts can access it

TFramework fw = LE.CreateFramework();

if( !fw.IsValid )

{

ErrOut( "Failed to initialize engine." );

return;

}

 

 

// Set Lua framework object

LE.SetGlobalObject( "fw", fw.Handle );

 

 

// Set Lua framework variable

IntPtr lua = LE.GetLuaState();

LE.lua_pushobject( lua, fw.Handle );

LE.lua_setglobal( lua, "fw" );

LE.lua_pop( lua, 1 );

 

 

LE.TFilter(1);

LE.AFilter(4);

 

// Get framework main camera

TCamera camera = LE.GetLayerCamera( LE.GetFrameworkLayer(0) );

LE.PositionEntity( camera, new TVec3(0,0,-2) );

 

//Load the scene

 

TEntity scene = LE.LoadScene("abstract::scene.sbx");

 

 

what am I doing wrong?

Link to comment
Share on other sites

I tested your code with LE.NET and the tunnels.sbx scene and it loaded and showed the scene.

 

One thing is that you may need to copy the Scripts (and its sub folders) to your bin\release or bin\debug directory

Another issue can be that your camera is placed or rotated so the scene isn't visible

Roland Strålberg
Website: https://rstralberg.com

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.

 Share

×
×
  • Create New...