Jump to content

problem with setting the entity-view-range


deniz
 Share

Recommended Posts

hi all,

 

I am trying to set view range parameters of entities loaded with LoadModel (we need to call this to enable lua scripts)

but calling EntityViewRange() does not seem to have any effect for such entities (loaded with LoadModel)

when I create meshes at run-time using LE-commands (CreateMesh, CreateSurface etc.), then EntityViewRange() works on them.

I tried to load the model with LoadMesh but it did not worked again (I have to use LoadModel anyway to run models' lua-scripts).

do I have to set a parameter in the lua-script or do I have to do something else?

 

any suggestions?

Link to comment
Share on other sites

Please post an example showing what you are trying to do. Otherwise it is very hard to guess what might be happening.

 

 

What do you mean by example?

the code or the model in question or both?

in case just the code is sufficient:

 

TEntity ent = LoadModel("xyz.gmf");

EntityViewRange(model, VIEWRANGE_INFINITE); // this does not have any effect

 

 

then I tried this:

TEntity ent = LoadMesh("xyz.gmf");

EntityViewRange(model, VIEWRANGE_INFINITE); // this does not have any effect as well

 

 

 

but if I try the following the code, EntityViewRange works just fine

TMesh mesh = CreateMesh();

TSurface surf = CreateSurface(mesh);

//...

// some commands to set vertices, normals and define a simple quad

//...

UpdateMesh(mesh);

EntityViewRangemesh, VIEWRANGE_INFINITE); // this works just fine..

 

 

 

so my question is:

how can I change the view-range of the model?

the model is exported from MAX using gmf-exporter.

remember: we are adding the model (or multiple copies/instances of it) to the scene during run-time.

so dragging an instance or multiple instances of the model into the scene and then loading the scene is out of question here.

do we have to include something in the lua-script of the model?

Link to comment
Share on other sites

Hmm, so you want it to show always, then VIEWRANGE_INFINITE should work, if you want something else, try VIEWRANGE_NEAR:

http://www.leadwerks.com/wiki/index.php?title=Entities#EntityViewRange

 

Is your camera view range setup correctly?

 

Please notice that:

The entity will not be drawn if it is further from the camera than the view range. If the recursive parameter is set to 1, all children in the entity's hierarchy will be set as well.

To change the world's view ranges, use SetWorldCullRange. [/Quote]

 

EDIT: also try setting recursive parameter to 1:

EntityViewRange( mode, VIEWRANGE_INFINITE , 1 ) 

Intel Dual Core 3GHz / GeForce GTS 450 - 1024 MB / Driver ver 267.59 / 8 GB RAM / Win 7 - 64 bit / LE2.50 / BMAX 1.48

game producer blog - Dead Wake Zombie Game powered by Leadwerks Engine

Twitter - Unfollow me

Link to comment
Share on other sites

Hmm, so you want it to show always, then VIEWRANGE_INFINITE should work, if you want something else, try VIEWRANGE_NEAR:

http://www.leadwerks.com/wiki/index.php?title=Entities#EntityViewRange

 

Is your camera view range setup correctly?

 

Please notice that:

 

 

EDIT: also try setting recursive parameter to 1:

EntityViewRange( mode, VIEWRANGE_INFINITE , 1 ) 

 

 

setting the recursive parameter to 1 solved the problem, thanks :D

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...