Home   Help Search Login Register  

Author Topic: Spin camera  (Read 1591 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
Spin camera
« on: 14 Apr 2005, 23:18:15 »
Is it possible to make a camera spin?
I mean a top view shot from a unit , keep him focused and flat spin the camera.
The camera must stay the whole time in the same position above the unit and spin.

   
Search or search or search before you ask.

Crassus

  • Guest
Re:Spin camera
« Reply #1 on: 15 Apr 2005, 02:06:42 »
I'm only guessing that it is possible. If not, I've a suggestion: as you can have cameras focus on Logics, just have the camera focus on one which is placed under or near your soldier, and script the Logic's rotation. I'm only guessing that when the Logic rotates, the camera will as well.

Please let me know how it works out. ;D

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spin camera
« Reply #2 on: 15 Apr 2005, 09:06:25 »
try this wee script -

Code: [Select]
_x = getpos tank_name select 0
_y = getpos tank_name select 1
_dir = getdir tank_name
_incr = 1
_angle = 0
_stop = false

_camera camSetTarget tank_name

#rotate

_camera camSetPos [_x + (0.1*sin(_dir+_angle)), _y + (0.1*cos(_dir+_angle)),7]
_camera camCommit 0

~0.001

_angle = _angle + _incr

?_angle>=360:_angle = 0

?not(_stop):goto "rotate"

exit


to stop the rotation, just set the variable _stop to true. if you want to stop it from outwith the script, make _stop a global variable by taking out the _.

thanks to fragorl and thobson for showing me how to do all that :)
« Last Edit: 15 Apr 2005, 09:09:14 by bedges »

Offline Blanco

  • Former Staff
  • ****
Re:Spin camera
« Reply #3 on: 15 Apr 2005, 11:36:15 »
What is wee?

I looked it up in my dictionary and it means "taking a leak, pie"
There was a script for that called nature's call :D

Anyway , I tried the script, it works but the camera is not spinning, it wobbles a bit like rocking chair.... the code looks ok tho...
I'm filming a dead unit and I want the camera start at a certain height, an spin the camera in a downwards spiral.


 
« Last Edit: 15 Apr 2005, 11:39:10 by Blanco »
Search or search or search before you ask.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Spin camera
« Reply #4 on: 15 Apr 2005, 11:44:25 »
Wee is originally a Scots word meaning small.   Though it also has the meaning you mention.
Plenty of reviewed ArmA missions for you to play

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spin camera
« Reply #5 on: 15 Apr 2005, 11:44:52 »
if it doesn't appear to be spinning, dunno what's up, as it worked just fine when i tested it. try increasing the distance from the object by adding to the 0.1 just before the sin/cos.

as for the downward spiral, i'd suggest declaring a variable for the height and gently changing it within the loop.

as an aside, i feel sort of silly giving scripting advice to someone who codes  defusable timebombs...  :-[

just a wee bit silly though ;)

Offline Blanco

  • Former Staff
  • ****
Re:Spin camera
« Reply #6 on: 15 Apr 2005, 12:13:47 »
Code: [Select]
as an aside, i feel sort of silly giving scripting advice to someone who codes  defusable timebombs...  

Lol, this is math and trigometry and I'm bad with it.
**edit**
Wait a minute, I think I found a way...  :P... testing...

**edit2**
Oh yeah, this is working...   :)
Just a small glitch to solve when the camera starts...


« Last Edit: 15 Apr 2005, 12:54:31 by Blanco »
Search or search or search before you ask.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spin camera
« Reply #7 on: 15 Apr 2005, 13:17:53 »
cool. any chance you could let us see when it's done?

Offline Blanco

  • Former Staff
  • ****
Re:Spin camera
« Reply #8 on: 15 Apr 2005, 13:49:38 »
Here we go, It's based on the perimeter script...  :D

Code: [Select]
_cameraid = _this select 0
_target = _this select 1
_height = _this select 2
_minheight = _this select 3
_radius = _this select 4
_steps = _this select 5
_speed = _this select 6

cuttext ["","Black out",0.00000001]
_stepsarray = []
_deg=0
_splitdeg=360/(_steps-1)
_newheight = _Height - _minheight
_inc = _newheight / _steps
endspin = false
_log = "logic" camcreate [getpos _target select 0,getpos _target select 1,(getpos _target select 2) + _height]

_pos=getpos _log
_px=_pos select 0
_py=_pos select 1

#createpositions
_steps =_steps -1
?(_steps < 0): goto "startcam"
_deg=_deg+_splitdeg
_posx= _px+(_radius*(sin(_deg)))
_posy= _py+(_radius*(cos(_deg)))
_height = _height - _inc
_stepsarray = _stepsarray + [[_posx,_posy,_height]]
goto "createpositions"
~(0.1 * _steps)
#startcam
_i = 0
cuttext ["","Black in",3]
_cameraid camsetpos (_stepsarray select _i)
_cameraid camsettarget _target
_cameraid camcommit 0
@camcommitted _cameraid

#Cycle
_cameraid camsetpos (_stepsarray select _i)
_cameraid camsettarget _target
_cameraid camcommit _speed
@camcommitted _cameraid
 
_i = _i + 1
?_i < (_this select 5) : goto "cycle"
endspin = true

;player globalchat format ["%1",_stepsarray]
deletevehicle _log
exit

You have to run the script in your camerascript by following parameters :

1) Camera ID , most people use _camera
2) Object to film
3) Height of the camera will start spinning
4) Height of the camera will stop spinning
5) Radius of the spiral in meters (use 1m for asort of  flat spin)
6) Steps, the more the smoother
7) Speed of the spin.


First create your camera :

Code: [Select]
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal","back"]

...and run the script :

example :

[_camera,man1,50,1.6,4,50,1] exec "spin.sqs"
@endspin

This will make the camera  start spinning 50m above the unit,the camera spins downward (in 50 steps) in a spiralmovement  (4m radius). He will stop spinning when the camera is 1.6m above the ground.
Speed is 1, which is slow.  

You need also @endspin to stop the script.

Bugs :

- When speed is high (like 0.1) , sometimes the camera make weird jumps. I don't think it's a problem with the script, cause I've seen it before in a normal camscript.

Now I'm working on a testdemo.  :)




« Last Edit: 15 Apr 2005, 14:12:18 by Blanco »
Search or search or search before you ask.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Spin camera
« Reply #9 on: 15 Apr 2005, 14:36:32 »
hmmm.... seems a very complicated way of doing it. see attached.


Offline Blanco

  • Former Staff
  • ****
Re:Spin camera
« Reply #10 on: 15 Apr 2005, 14:53:20 »
 :-\

You are right, your script is MUCH easier.  :)

I moved the :

_x = getpos object_name select 0
_y = getpos object_name select 1
_dir = getdir object_name

...into the loop so the camera spins correctly around a moving object.

Great, thanks a lot.
Search or search or search before you ask.