How to make camera moving?
by Dawid Zwiewka · in Game Design and Creative Issues · 08/22/2009 (6:07 pm) · 2 replies
Hi! I am new in TGB. I read documentation and few topics but in all functions called in t2dSceneWindow i get error... For example:
Could somebody tell me what is wrong? I tried to call a few more funcions exactly like in documentations but every time i get error that "invalid number of parameters" but explain me how it is possible to call with invalid number of arguments if function doesn't take arguments and i call it without arguments?
PS. sorry for my english
function Player::onLevelLoaded(%this, %scenegraph)
{
$Player = %this;
moveMap.bindCmd(keyboard, "up", "PlayerUp();", "PlayerUpStop();");
moveMap.bindCmd(keyboard, "left", "PlayerLeft();", "PlayerLeftStop();");
moveMap.bindCmd(keyboard, "right", "PlayerRight();", "PlayerRightStop();");
$Player.up = false; $Player.right = false; $Player.jumping = false; $Player.left = false;
%rect = t2dSceneWindow::getCurrentCameraArea();
t2dSceneWindow::dismount();
t2dSceneWindow::setTargetCameraArea(getWord(%rect, 0), getWord(%rect, 1), getWord(%rect, 2), getWord(%rect, 3));
t2dSceneWindow::setTargetCameraPosition(%this.getPositionX(), %this.getPositionY(), 100, 75);
t2dSceneWindow::startCameraMove(10000);
}and camera isn't moving and i see that in console:game/gameScripts/player.cs (9): ::getCurrentCameraArea - wrong number of arguments. game/gameScripts/player.cs (9): usage: () Get current camera Area. @return The camera area formatted as "x1 y1 x2 y2" game/gameScripts/player.cs (10): ::dismount - wrong number of arguments. game/gameScripts/player.cs (10): usage: () Dismounts Camera from object.@return No return value t2dSceneWindow::setTargetCameraArea() - Invalid number of parameters! t2dSceneObject::setArea() - Invalid number of parameters! t2dSceneWindow::startCameraMove - Cannot use this command when camera is mounted!so know i have no idea why it doesn't work... For example function dismount. I call it like this: dismount() and i get error that "wrong number of arguments" and that i should call exactly in that same way like i am doing...
Could somebody tell me what is wrong? I tried to call a few more funcions exactly like in documentations but every time i get error that "invalid number of parameters" but explain me how it is possible to call with invalid number of arguments if function doesn't take arguments and i call it without arguments?
PS. sorry for my english
About the author
I'm not from UK/USA so I'm sorry in advance for all grammatical mistakes :)
#2
I know i can mount camera. I know many functions but it's about that no function did work. I simple copy, past example code from many topics on that forum and no function works. It wasn't because of wrong arguments.
It was because there is no function working like that for me:
Does it work for anybody?
Unfortunately documentation doesn't show examples, just parameters, and name of function. It doesn't say what object i should use when calling some camera function.
Anyway i asked that question a long time ago and i already learned much more ;)
10/14/2009 (5:28 pm)
Already i did it.I know i can mount camera. I know many functions but it's about that no function did work. I simple copy, past example code from many topics on that forum and no function works. It wasn't because of wrong arguments.
It was because there is no function working like that for me:
t2dSceneWindow::ANY_FUNCTION()I have to write that:
sceneWindow2D.ANY_FUNCTION()But i read many topics and everywhere people write that first way is correct. When they write sample code it looks like in first way and that didn't work for me.
Does it work for anybody?
Unfortunately documentation doesn't show examples, just parameters, and name of function. It doesn't say what object i should use when calling some camera function.
Anyway i asked that question a long time ago and i already learned much more ;)
Torque 3D Owner Dustin Mellen