Jump to content
Sign in to follow this  
5133p39

preloadObject

Recommended Posts

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">distance preloadObject object

If i understand it correctly #1:

This command can be used to preload objects which aren't yet present in the game world.

If i understand it correctly #2:

It could be used instead of pre-placing the objects in the mission editor to reduce lag when spawning these objects at runtime.

Am i right?

If yes, then i would like to know, what is the purpose of distance parameter?

There is nothing about it in the wiki.

Share this post


Link to post
Share on other sites

I would say the distance is for lod-determination but it doesn't really add up smile_o.gif

Share this post


Link to post
Share on other sites

Well you 5133p39 are thinking the same about it as I do. I'd also like to know more of the distance parameter.

Share this post


Link to post
Share on other sites

exactly what you think it does; its the distance from the object that it will render.

i used the command

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

@10 preloadobject recon1

in my intro and the game would wait until everything in that distance would load before moving on. once the last thing loaded, and i mean the exact millisecond it loaded, it moved to the next camera position (a ~ command would work to make it wait in that spot though).

as for preloading things i havent had any real success with the commands (not just preloadobject) except when i use @ in front of the commands. if i put it in the init.sqs or initintro.sqs it would't help at all, so using the @ in front is the only thing i noticed where it actually worked....of course when you use the @ command it screws up the timing of everything else in the intro.

Share this post


Link to post
Share on other sites

What I would think it does :

you want to setPos the player, and avoid the long texture loading thing that happens at these times (new scene rendered).

Use preloadObject on something at the setPos position with correct preload distance (to render most of the surroundings), wait until it's finished (in the meantime, continue as before) before setPos'ing the player

Share this post


Link to post
Share on other sites
What I would think it does :

you want to setPos the player, and avoid the long texture loading thing that happens at these times (new scene rendered).

Use preloadObject on something at the setPos position with correct preload distance (to render most of the surroundings), wait until it's finished (in the meantime, continue as before) before setPos'ing the player

That's what I used preloadCamera for:

http://community.bistudio.com/wiki/preloadCamera

waitUntil{preloadCamera _newPos};

player setpos _newPos;

Btw, am I the only one that have yet to see textures load even when setPossing over the map? (Since v1.08 that would be)

Share this post


Link to post
Share on other sites
What I would think it does :

you want to setPos the player, and avoid the long texture loading thing that happens at these times (new scene rendered).

Use preloadObject on something at the setPos position with correct preload distance (to render most of the surroundings), wait until it's finished (in the meantime, continue as before) before setPos'ing the player

What you wrote is completely different from what is written in the wiki:

Preload all textures, materials and proxies needed to render given object. Object can be determined either by config class name, or by object id.

Returns true once all data is loaded and ready.

...i did some testing, and when i set the distance parameter to some high number (10000) then the objects, which were this way "preloaded", created in front of the player, were often distorted (the model looked like it came through meat-grinder and the unit was partially submerged in the ground).

But no matter to what walue i set the distance parameter, there was still approx 0.5 second lag when creating this object.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×