Jump to content
stanhope

[Fixed] Forcing player to look down

Recommended Posts

Right so in the singleplayer mission I'm making I'm throwing the player off of the side of the destroyer.  This happens right after a briefing in which cinemaBorder is set and the player is attached to the destroyer.

This is the code i'm using:

player switchMove "Acts_MHCargo_JumpToWater_all";  
detach player; 
player doWatch (getPos LookAtObject);
player lookAt (getPos LookAtObject);
sleep 0.5;
[1, 1, false, true] call BIS_fnc_cinemaBorder;
sleep 2.5; 
player switchMove ""; 

 

However the player isn't looking down when this is executed. I have also tried executing look at and do watch after retracting the cinematic border, didn't work.

Does anyone know how I might be able to force the player to look down?

Share this post


Link to post
Share on other sites

It euh, does what is says in the description.  It pitches the player down when I execute that code.  However as soon as I close the debug menu it puts me back in the normal position.  And during the jumping down part it doesn't work whatsoever.  
Is there a way to only rotate the players head with this function or something?


code I used for this testing:

player switchMove "Acts_MHCargo_JumpToWater_all";  
detach player; 
sleep 0.5;
[1, 1, false, true] call BIS_fnc_cinemaBorder;
[player, -45, 0] call BIS_fnc_setPitchBank;
sleep 2.5; 
player switchMove ""; 

(The animation takes just a tad more than 3 seconds.)

Share this post


Link to post
Share on other sites

You could create a camera, hide the player and make the camera do the movement from first person view, just set the camera position to the eyePos of the player on every frame, should do the trick.

There are no functions/script commands to manipulate where the regular player camera is pointing towards.

 

Cheers

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Right, that seems to do what I want but I'm having a slight issue with it.  It creates the camera, it looks at what I want it to look at and it gets destroyed when I want it to but it doesn't move the cam.  And I don't know why.  Anyone know what I'm doing wrong?

player switchMove "Acts_MHCargo_JumpToWater_all";  
detach player; 

_cam = "camera" camCreate (eyePos Hawkins);
_cam cameraEffect ["internal", "BACK"];
_cam camSetTarget LookAtObject;

[1, 1, false, true] call BIS_fnc_cinemaBorder;
_cam camCommit 0.5;
sleep 0.5;

["someId", "onEachFrame", {
  _cam camSetTarget LookAtObject;
  _cam camSetPos (eyePos Hawkins);
  _cam camCommit 0;
}] call BIS_fnc_addStackedEventHandler;
sleep 2.5; 
["someId", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
_cam cameraEffect ["terminate","back"];
camDestroy _cam;
player switchMove ""; 

(Hawkins is the var name of the player)

Share this post


Link to post
Share on other sites
1 hour ago, stanhope said:

Right, that seems to do what I want but I'm having a slight issue with it.  It creates the camera, it looks at what I want it to look at and it gets destroyed when I want it to but it doesn't move the cam.  And I don't know why.  Anyone know what I'm doing wrong?


player switchMove "Acts_MHCargo_JumpToWater_all";  
detach player; 

_cam = "camera" camCreate (eyePos Hawkins);
_cam cameraEffect ["internal", "BACK"];
_cam camSetTarget LookAtObject;

[1, 1, false, true] call BIS_fnc_cinemaBorder;
_cam camCommit 0.5;
sleep 0.5;

["someId", "onEachFrame", {
  _cam camSetTarget LookAtObject;
  _cam camSetPos (eyePos Hawkins);
  _cam camCommit 0;
}] call BIS_fnc_addStackedEventHandler;
sleep 2.5; 
["someId", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
_cam cameraEffect ["terminate","back"];
camDestroy _cam;
player switchMove ""; 

(Hawkins is the var name of the player)

 

Any reason why you're using outdated BIS functions? There's already a mission eventhandler for eachFrame, same goes for cinema border.

You're not passing the cam object to the scope of the onEachFrame eventhandler.

Since the Hawkins variable is already global, set the cam as a variable on the player, something like this could work:

_test = [] spawn {

	player switchMove "Acts_MHCargo_JumpToWater_all";
	detach player;

	_cam = "camera" camCreate (eyePos Hawkins);
	Hawkins setVariable ["TAG_fnc_cam",_cam];
	_cam cameraEffect ["internal", "BACK"];
	_cam camSetTarget LookAtObject;

	showCinemaBorder true;
	_cam camCommit 0.5;
	sleep 0.5;
	TAG_fnc_cancelCam = false;
	addMissionEventHandler ["eachFrame",{

		_cam = Hawkins getVariable ["TAG_fnc_cam",objnull];
		_cam camSetPos (eyePos Hawkins);
		_cam camCommit 0;
		if (TAG_fnc_cancelCam) then {

			removeMissionEventhandler ["eachFrame",_thisEventhandler];
			_cam cameraEffect ["terminate","back"];
			camDestroy _cam;
			player switchMove "";
		};
	}];
sleep 3;
TAG_fnc_cancelCam = true;

}

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites
5 minutes ago, Grumpy Old Man said:

Any reason why you're using outdated BIS functions?

Looking at the code from old missions, googling the params and not seeing the new commands in the 'see also' section :)

 

Thanks for the help.

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

×