Jump to content
Sign in to follow this  
DancZer

Spline camera script

Recommended Posts

The arma 2 camera scripted movements are quite basic (point to point), and the movement is choppy, I came to create a better controller for it.

What i did lets the camera move along a spline path, what can be created with help of beziers.

How to install:

You have to copy the scripts folder to the mission root directory, and you have to call this command in the init.sqf:

[] call compile preprocessFile "spline_cam_scripts\spline_cam_script_init.sqf";

How to use:

The spline format is a 4 part array.

Single spline array:[pos1,c1pos,c2pos,pos2]

The animation functions uses splines array.

Example spline:

http://en.wikipedia.org/wiki/File:Bezier_curve.svg

P0 = pos1

P1 = c1pos

P2 = c2pos

P3 = pos2

The second methot with 2 degree:

http://upload.wikimedia.org/wikipedia/commons/f/f2/Spline01.gif (169 kB)

Example script:

How to join 2 splines?

t8RHyr5.png

spline1 = [pos1,c1pos,c2pos,pos2];

spline2 = [pos2,c1pos1,c2pos1,pos3];

splines = [spline1 ,spline2]];

[splines ] call SPLINE_DZ_CALIBRATESPLINESPOS;

handle = [splines, 100,30,0.01] spawn SPLINE_DZ_ANIMATE_SPLINE_FOLLOW_CAM;

WaitUntil{ScriptDone handle};

This function moves the cam on a spline path pointed on a stationary target.

[splines array, target pos, play duration, update interval] spawn SPLINE_DZ_ANIMATE_SPLINE_FIXPOS_CAM;

This function moves the cam on a spline path pointed on a object(can be moving target too).

[splines array, target object, play duration, update interval] spawn SPLINE_DZ_ANIMATE_SPLINE_FIXPOS_CAM;

This function moves the cam on a spline path pointed on the direction of the movement.

[splines array, target distance, play duration, update interval] spawn SPLINE_DZ_ANIMATE_SPLINE_FOLLOW_CAM

splinesfollow.png

This function moves the cam on a spline path pointed on another spline.

[splines array, splines array, play duration, update interval] spawn SPLINE_DZ_ANIMATE_SPLINE_SPLINE_CAM

This function smoothes two connected spilnes (with the adjustment of the position of connection point)

[splines array] call SPLINE_DZ_CALIBRATESPLINESPOS;

These are the cam movements in the demo mission:

Download:

Script source and demo mission: dev-heaven.net

If you use it, please give my name in credits.

DancZer

Edited by danczer

Share this post


Link to post
Share on other sites

It is very interesting script :bigsmile:

Camera altitude adjusted to ground level? It might adjust to sea level.

Share this post


Link to post
Share on other sites
It is very interesting script :bigsmile:

Camera altitude adjusted to ground level? It might adjust to sea level.

Thank you!

The command camSetPosASL not exist, so now I use setCameraPos, but in the future will be with camSetRelPos and the spline positons will be posASL.

Share this post


Link to post
Share on other sites

It will be nice. Expected waiting for completion :)

Share this post


Link to post
Share on other sites

Uploaded the script the demo mission and the spline-spline cam movement video.

Share this post


Link to post
Share on other sites

Have you tried using a unit rather than a camera? In debug mode, I replaced the Sign_sphere25cm_EP1 with a reference to a preplaced unit that I switched into using selectPlayer, with the following init:

removeAllWeapons this; this hideObject true; this addEventhandler ["handledamage",{}]; this enableSimulation false

With enableSimulation false you take away all controls like a regular camera, but you'll always see straight ahead - no pitch control (will try setVectorUp later). Having it enabled, you get a camera on a fixed path which the player can say where he wants to look. If you want the camera borders, you could always use the custom borders like Eagle Wing does.

What are the benefits? Interactivity with simulation activated, fully smooth using setPosASL, and you get to hear ambient sound effects (not the loops which work always, but the sfx played together with that loop, which for some reason doesn't play in camera view). If you use allowDamage false, you'll still get the hit effects even if you don't take damage - such as blurred vision with blood on it. Handledamage eventhandler nothing, removes all this.

I think visualized 3D spline curves in Arma3 3D editor would be a fantastic aid for stuff like this.

Edit: Oh never mind. Hit effects still kick in, and simulations enabled doesn't work properly, when the scene gets a bit more busier than map flying.

Edited by CarlGustaffa

Share this post


Link to post
Share on other sites

Interesting idea. This could be an another type of camera.

Yeah it would be nice to see something like this in Arma 3.

For hit effect: What if unit is a seagull? :)

Share this post


Link to post
Share on other sites

Will try the seagull. Stupid of my not to think in that direction :D

Are you still working with implementing splines into Arma? Might be nice with knot based curves that passes through the user placed knot points, where the control points are created automatically. Also useful would be a preview mode where spheres are drawn in 3D and markers placed in the 2D map, with reduced interval of course.

Anyhow, I love the stuff. Very smooth :p

Share this post


Link to post
Share on other sites

Nope, i'm working on another project yet. Feel free to develop. :)

Share this post


Link to post
Share on other sites

Download link seems to be down, anyone know where it's hosted ?

Share this post


Link to post
Share on other sites
Download link seems to be down, anyone know where it's hosted ?

Fixed!

Share this post


Link to post
Share on other sites

Download link still down or down at the moment. File doesn't exist.

Share this post


Link to post
Share on other sites
Download link still down or down at the moment. File doesn't exist.

Right, i fixed the demo mission link and i forgot the script link. :) But now booth are correct. :)

Share this post


Link to post
Share on other sites

Looks interesting gona give this a try on my next video

Share this post


Link to post
Share on other sites

I updated the first comment. There are two more images to show how to use splines. I hope these images help a lot. :)

Share this post


Link to post
Share on other sites

As i see the links are dead. I will fix the links as soon as possible.

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  

×