Home   Help Search Login Register  

Author Topic: Use of preloadCamera?  (Read 2143 times)

0 Members and 1 Guest are viewing this topic.

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Use of preloadCamera?
« on: 19 Sep 2007, 00:20:11 »
Hi all!

I have a cutscene, that is suffering heavy from LOD bugs, and it has been suggested to me to use preloadCamera to prevent this. As far as I know, the syntax would be preloadCamera [X,Y,Z], but how do I find out what the X,Y,Z numbers for the position my camera is looking at are?
Help on this topic would be greatly appreciated because I have not found the proper solution by searching the forum.

Thanks,

Mathias

Offline Cheetah

  • Former Staff
  • ****
Re: Use of preloadCamera?
« Reply #1 on: 19 Sep 2007, 07:24:31 »
Do you use the camera.sqs script to write your intro.sqs? Guess not, because you get those coordinates if you do use them.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Re: Use of preloadCamera?
« Reply #2 on: 19 Sep 2007, 16:53:23 »
Hi Cheetah!

No, I just let the cam target objects... but as I glanced at the camera.sqs tutorial, it is most likely to solve my problem once I have worked trough it.

Thanks for leading me to the right direction.

Cheers

Mathias

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Use of preloadCamera?
« Reply #3 on: 19 Sep 2007, 17:49:20 »
preloadCamera "ensures" (when it works) that all the textures around a point are loaded before you switch the real camera to work around that position. In earlier versions of ArmA, preloadCamera did work pretty well, now it works once out of every 99 times correctly. Anyway you may try it and see the results.
preloadCamera returns true when all the area (in visual range) around the indicated coords has been preloaded (which might take few seconds). So you may use, for example
Code: [Select]
waitUntil {preloadCamera getPos mylogcamera};
// Area preloaded, lets switch the camera to the action area now

or
Code: [Select]
@!preloadCamera getPos mylogcamera


Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Re: Use of preloadCamera?
« Reply #4 on: 19 Sep 2007, 23:44:46 »
Thank you people!

Just copying and pasting the position from the camera.sqs into my intro.sqs did the trick, preloadCamera was not necessary. But many thanks still to mandoble, because I might need the additional information some day.

Thank you both!

Mathias

Offline nettrucker

  • Members
  • *
  • Too young to die-OFP Campaign by TOY & nettrucker
Re: Use of preloadCamera? I need help too
« Reply #5 on: 06 Oct 2007, 13:17:55 »
Hi everybody

I need some help. I'm posting this here because it's related to this topic. I have some serious troubles to understand what commands and in which sequence they have to be used to avoid having these annoying M LOD problems. I'm doing something wrong cause I can't get it to work. I'm stuck with my mission which is in beta testing. I need to do all the voiceover but for that I need the camscripts to be fixed. Please could someone have a look at this and tell me what I'm doing wrong. :dunno:
So here's some of lines of my intro.sqs

Code: [Select]
showCinemaBorder false
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
titlecut [" ","BLACK IN",2]
preloadCamera [17728.816406,64.980003,12407.526367]
_camera camPrepareTarget [17728.816406,64.980003,12407.526367]
_cam camsettarget flag
_cam camsetrelpos [0,15,2]
_cam camSetFOV 0.500
_cam camcommit 0
@camcommitted _cam
~15
preloadCamera [13241.333984,19.485001,8848.729492]
_camera camPrepareTarget [13241.333984,19.485001,8848.729492]
speechramirez = true
titlecut [" ","BLACK IN",2]
_cam camsettarget ap
_cam camsetrelpos [1,9,1.8]
_cam camSetFOV 0.200
_cam camcommit 0
@camcommitted _cam
~25

When the camera switches from "flag" to "ap" heavy rendering problems. I don't know if I'm using the right commands. I'm using still some old syntax form former OFP can I combine both types of syntax AA - OFP in a script? :dunno:
Some help is really appreciated.
thanks in advance
nettrucker

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Use of preloadCamera?
« Reply #6 on: 06 Oct 2007, 15:41:59 »
To start with, you are not waiting till camera has been preloaded. Check 3 posts above.

Offline nettrucker

  • Members
  • *
  • Too young to die-OFP Campaign by TOY & nettrucker
Re: Use of preloadCamera?
« Reply #7 on: 06 Oct 2007, 17:12:11 »
Hello Mandoble

I'm sorry I don't understand, please could you enlighten me how to apply your above mentioned code applying it on my script in order to get it to work. I'm a noob in scripting. I'm having a hard time to understand the syntax. It would help me a lot since I'm kind of a visual learning guy. where do I have to insert your code and what does the variable mylogcamera stand for.
Thanks and in advance for having patience with me and helping me out.
regards
nettrucker :dunno:

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Use of preloadCamera?
« Reply #8 on: 06 Oct 2007, 17:37:08 »
Code: [Select]
@ preloadCamera [17728.816406,64.980003,12407.526367]

That will wait there until all textures near the position have been preloaded.
If you dont wait and proceed to commit your real camera, your camera will be surrounded with terrain still loading its textures.


Offline nettrucker

  • Members
  • *
  • Too young to die-OFP Campaign by TOY & nettrucker
Re: Use of preloadCamera?
« Reply #9 on: 06 Oct 2007, 17:51:36 »
Hi Mandoble
Thanks for enlighten me. I gonna try this right now.
Thanks a bunch man.
Regards
nettrucker :D

Edit: I still can't get it to work. what am I missing apart that I didn't put the condition before the preload camera command?
I'm using the following script now
Code: [Select]
showCinemaBorder false
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
titlecut [" ","BLACK IN",2]
@preloadCamera [17728.816406,64.980003,12407.526367]
_camera camPrepareTarget [17728.816406,64.980003,12407.526367]
_cam camsettarget flag
_cam camsetrelpos [0,15,2]
_cam camSetFOV 0.500
_cam camcommit 0
@camcommitted _cam
~15
@preloadCamera [13241.333984,19.485001,8848.729492]
_camera camPrepareTarget [13241.333984,19.485001,8848.729492]
speechramirez = true
titlecut [" ","BLACK IN",2]
_cam camsettarget ap
_cam camsetrelpos [1,9,1.8]
_cam camSetFOV 0.200
_cam camcommit 0
@camcommitted _cam
~25
I don't understand it should work now? :scratch:
I need help!
regards
nettrucker
« Last Edit: 06 Oct 2007, 18:19:54 by nettrucker »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: Use of preloadCamera?
« Reply #10 on: 10 Oct 2007, 13:13:44 »
Hi nettrucker,

why do you have

_cam and _camera in your script?

To me that looks very much like a potential error.

Best Regards,
Baddo.