Blockland Forums > Modification Help
PathCamera
Space Guy:
I once had a test map trying to use them for a "plane landing" sequence but I can't find it now...
EDIT: aha, found some of the code. It might help a little.
--- Code: ---datablock PathCameraData(PathObserver : Observer)
{
somefield = 1;
};
--- End code ---
Making it a copy of Observer even though Observer is a 'normal' camera datablock works. I have to set at least one field otherwise syntax errors come up.
--- Code: ---%client.camera.delete();
%client.camera = new PathCamera()
{
datablock = PathObserver;
position = %client.player.getPosition();
rotation = "0 0 1 0";
};
%client.setControlObject(%client.camera);
--- End code ---
Replaces a set client's 'camera' with a PathCamera. This particular one was for some kind of 'single player' mode that never worked out so using F8 was disabled anyway, but you might want a better solution to store a PathCamera and a normal Camera at the same time.
--- Code: ---%client.camera.setTransform("392.5 -819.5 74 0.115759 0.212569 0.970265 4.11377");
%client.camera.pushBack(AICamera.getPosition() SPC eulerToAxis("26 0 125"),50 ,"Normal","Linear");
%client.camera.pushBack("387.5 -820.5 75" SPC eulerToAxis("20 0 115"),1 ,"Normal","Linear");
--- End code ---
Giving it a start position and rotation, then a set path to move along.
WRB852:
I tried doing what you said, and I'm still being sent out into the middle of nowhere. Maybe I could send you it, and you could see what's maybe wrong first hand?
Space Guy:
Well, the setTransform is a completely arbitrary position related to the map I had. Don't just copy-paste everything in my post, it won't work like that.
WRB852:
No, I definitely didn't do that. I'm not a complete idiot!
Here's what I have:
--- Code: ---function camcorderImage::onFire(%this,%obj,%slot)
{
%transform = %obj.gettransform();
%a = 1;
%b = "normal";
%c = "spline";
%obj.timesFired += %a;
echo(%obj.timesFired);
if(%obj.timesFired = 1)
{
%obj.client.pathcamera.setTransform(%transform);
%obj.client.pathcamera.pushBack(%transform,%a,%b,%c);
} else {
%obj.client.pathcamera.pushBack(%transform,%a,%b,%c);
}
}
function ServerCmdpathCameraStart(%client)
{
%client.pathcamera.setPosition(0.0);
%client.pathcamera.setTarget(1.0);
%client.pathcamera.setState("forward");
%client.setcontrolobject(%client.pathcamera);
}
function ServerCmdpathCameraEnd(%client)
{
%client.setcontrolobject(%client.camera);
}
--- End code ---
From my understanding, it should start at where I first fired the tool, and then travel along the path of where I fired after that. For some reason, it still takes me out in space.
Desolation:
I would also like to see a working version of this, I tinkered around for about a hour trying to figure out how it works, I had the same results as WRB852.