Guest Posted January 5, 2008 Share Posted January 5, 2008 Positioning the Camera: Ok, I'm trying to place my character at a position, and have my camera look at him there. I'm having problems getting my camera to position/look correctly: Server: function spawnFunct ( playerNode, inout ) if (inout == 0) then local dones bindTheKeys( playerNode ) playerSkin[ playerNode ] = 1 setPlayerSkin(source, PlayerClasses[ playerSkin[ source ] ] ) spawnPlayer ( playerNode, 2438.6921, -54.5835,28.1535, 354.0469 ) dones = setCameraMode( playerNode, "fixed" ) if (dones) then SendText( "Fix: Good" ) else SendText( "Fix: Bad" ) end triggerClientEvent ( "onJoin", root, playerNode ) end end SpawnFunct gets called everytime a player joins Client root = getRootElement() function playerJoin ( playerNode ) setTimer ( setCameraPosition, 1000, 1, source, 2438.6921, -54.5835,28.1535, 354.0469 ) setTimer ( setCameraLookAt, 1000, 1, source, 2438.6921, -54.5835,28.1535, 354.0469 ) SendText( "Grrr. Did I get here?", playerNode ) end addEvent("onJoin", true) addEventHandler("onJoin", getRootElement(), playerJoin) function SendText( text, playerid ) outputChatBox( text, playerid ) end The camera does not get moved or anything. What am I doing wrong? Link to comment
Silentlink Posted January 5, 2008 Share Posted January 5, 2008 root = getRootElement() function playerJoin ( playerNode ) then <---- Hm? setTimer ( setCameraPosition, 1000, 1, source, 2438.6921, -54.5835,28.1535, 354.0469 ) setTimer ( setCameraLookAt, 1000, 1, source, 2438.6921, -54.5835,28.1535, 354.0469 ) SendText( "Grrr. Did I get here?", playerNode ) end addEvent("onJoin", true) addEventHandler("onJoin", getRootElement(), playerJoin) function SendText( text, playerid ) outputChatBox( text, playerid ) end Alright, I'm horrible at Lua but shouldn't there a then where I've marked? Link to comment
mabako Posted January 5, 2008 Share Posted January 5, 2008 You're lacking setCameraMode to "fixed" Link to comment
Guest Posted January 5, 2008 Share Posted January 5, 2008 You're lacking setCameraMode to "fixed" function spawnFunct ( playerNode, inout ) if (inout == 0) then local dones bindTheKeys( playerNode ) playerSkin[ playerNode ] = 1 setPlayerSkin(source, PlayerClasses[ playerSkin[ source ] ] ) spawnPlayer ( playerNode, 2438.6921, -54.5835,28.1535, 354.0469 ) [u][b]dones = setCameraMode( playerNode, "fixed" )[/b][/u] if (dones) then SendText( "Fix: Good" ) else SendText( "Fix: Bad" ) end triggerClientEvent ( "onJoin", root, playerNode ) end end Question, setCameraMode can only be used server side right? Link to comment
Guest Posted January 5, 2008 Share Posted January 5, 2008 You can use toggleCameraFixedMode for client-side scripts. Link to comment
Guest Posted January 6, 2008 Share Posted January 6, 2008 addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), setupSpawn ) Would be to add the function setupSpawn for onClientPlayerSpawn, does that include the player yourself? LIke for when you spawn? Link to comment
eAi Posted January 6, 2008 Share Posted January 6, 2008 dab, not entirely sure what you're saying. The code you quote will call the function only when the local player spawns. Link to comment
Guest Posted January 6, 2008 Share Posted January 6, 2008 Im trying set camera with server-side scripts.But it wont wok. function OnPlayerSpawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) setTimer ( setCameraPosition, 1000, 1, source, -2618.9541,1414.4677,7.1016 ) setCameraMode ( source, "fixed" ) toggleAllControls ( source, false ) bindKey ( source, "enter", "down", unfreezeBind ) end addEventHandler ( "onPlayerSpawn", getRootElement(), OnPlayerSpawn ) How can i make it work ? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now