Home   Help Search Login Register  

Author Topic: Logic-cam 1.0  (Read 2072 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
Logic-cam 1.0
« on: 02 Mar 2004, 18:20:36 »
Requirements:

- Basic knowledge camera scripting
- Original copy of PC CDROM game Operation Flashpoint or Flashpoint Resistance.

What this script is
This script allows you to attach a camera to a vehicle. It can be used to attach a camera to any object or any position relative to that object in the game.

E.g. you can show the driver position, cargo position, roof cam, wheelcam…

In a "normal" camera script there are two essential commands:

Camsetpos : Sets the x,y,z position of the camera in the world
Camsettarget : Points the camera at the object

In logic-cam these two positions are replaced by the positions of two gamelogics (automatically created in the script) then logic-cam sets the x,y,z positions of both gamelogics relative to the vehicle via a constant loop and a setpos command.

I suggest you try the Demo mission(6min), it contains about 50 different examples how to use logic-cam. It shows you a roofcam, bumpercam, wheelcam, drivercam, cargocam, gunnercam and many many others… You don't need addons, simply load the mission in the editor, and then click on 'preview' to see it in action.

Let me know what you think.

here is the script

Code: [Select]
;Logiccam1.0
;author <Blanco>
;created 25/02/2004 5:07:54
;________________________
;::::::::::::::::::::::::

startglcam = true
_camid = _this select 0
_tgt = _this select 1
_gl1prop = _this select 2
_tgt2 = _this select 3
_gl2prop = _this select 4
_setvof = _this select 5

_gl1 = "logic" camcreate getpos _tgt
_gl2 = "logic" camcreate getpos _tgt2

#loop
?!(startglcam) : goto "endcam"
_tgtdir = getDir _tgt + (_gl1prop select 0)
_tgtx = getPos _tgt select 0
_tgty = getPos _tgt select 1
_tgtz = getPos _tgt select 2



_tgtxdir = _tgtx + (_gl1prop select 1)* (sin _tgtdir)
_tgtydir = _tgty + (_gl1prop select 1)* (cos _tgtdir)


_tgtdir2 = getDir _tgt2 + (_gl2prop select 0)
_tgtx2 = getPos _tgt2 select 0
_tgty2 = getPos _tgt2 select 1
_tgtz2 = getPos _tgt2 select 2

_tgtxdir2 = _tgtx2 + (_gl2prop select 1)* (sin _tgtdir2)
_tgtydir2 = _tgty2 + (_gl2prop select 1)* (cos _tgtdir2)

_gl1 setDir _tgtdir
_gl2 setDir _tgtdir2

_gl1 setPos [_tgtxdir,_tgtydir,_tgtz + (_gl1prop select 2)]
_gl2 setPos [_tgtxdir2,_tgtydir2,_tgtz2 + (_gl2prop select 2)]


_camid camsetpos getpos _gl1
_camid camsettarget _gl2
_camid camsetfov _Setvof
_camid camcommit 0

goto "loop"
#endcam
@!(startglcam)
deletevehicle _gl1;deletevehicle _gl2
exit

PS : Check the README !
PS2 : If this belongs in the Editing/Scripting: Sound & Cutscenes board, please move it.
« Last Edit: 03 Mar 2004, 18:37:16 by Blanco »
Search or search or search before you ask.

Offline alimag

  • Contributing Member
  • **
  • I'm a llama!
Re:Logic-cam 1.0
« Reply #1 on: 04 Mar 2004, 14:32:00 »
Hi,

I just tried your demo. EXCELLENT!

Some of the camera angles are fantastic. Good work.

Warning: If I remember correctly, you cant delete a logic object. To test this just try displaying the object you just deleted (or is type - typeOf) and you'll see that it's still there. So calling the script 50 times will reate 100 logic objects. I'm not 100% sure but I think you should check.

Cheers

Offline Blanco

  • Former Staff
  • ****
Re:Logic-cam 1.0
« Reply #2 on: 04 Mar 2004, 16:52:16 »
hi, Alimag

I'm glad you liked it!

Good point about the gamelogics , i did the following test :

I moved in a gamelogic as driver during the night, so he turned the headlights on. Then I delete the gamelogic and the light goes out, so I guess the gamelogic is deleted...

But I will try your test with typeof to make sure...

Bear in mind that attaching a logiccam to a flying helicopter or plane can be a little tricky, because a plane can bank or tilt to the left or right and the logiccam can't folow the artificial horizon correctly. But I think that the only limitation...
When a plane's flying level, there's no problem.




Search or search or search before you ask.

Offline alimag

  • Contributing Member
  • **
  • I'm a llama!
Re:Logic-cam 1.0
« Reply #3 on: 04 Mar 2004, 23:04:45 »
If I may suggest something, I think that your script would be much more user friendly if we did not have to deal with numbers. A kind of a simplify interface.

Something like:

Jeep2, "RIGHTDOOR", "FRONT"

will place the camera on the jeep2 right door looking front.

Or something similar. Just a suggestion.

Cheers

Offline Blanco

  • Former Staff
  • ****
Re:Logic-cam 1.0
« Reply #4 on: 05 Mar 2004, 22:48:24 »
I agree, It takes some time to get the camera angle you want, but I don't think it's that difficult. When I need a logiccam in the middle of my camerascript, I always place the execution line ifirst (after camera creation), this way it takes about 2-4 min to get the camera angle I want.
imho ,the most difficult positions are those close to the centerpoint of the vehicle and closeups. In most cases the distances are the hardest to find, not the direction.

Quote
Jeep2, "RIGHTDOOR", "FRONT"

It is possible, but you have to change jeep2 into a vehicle class (via typeof maybe), because jeep2 could be anything in the editor. Predefined camera angles are a lot easier to use , but also very restricted.

I wish I could make it easier without those limits...




Search or search or search before you ask.