Page 1 of 1

Camera position

Posted: Fri Feb 06, 2015 11:41 am
by Braziliano
hello , is there A way to pre-set my camera view point .. when im focused on a target/npc whatever .. is it possible to force your screen to look at a certain angle?

Re: Camera position

Posted: Fri Feb 06, 2015 10:22 pm
by rock5
If you want to aim at something or at certain coordinates, you can use the aimAt function.
To aim at npc

Code: Select all

npc = player:findNearestNameOrId(npcNameOrId)
player:aimAt(npc)
or to point at certain coordinates

Code: Select all

player:aimAt({X=1, Z=2, Y= 3})
If you actually need to point at a certain angle then there is a camera class you can use. Try

Code: Select all

camera:setRotation(angle)
The angle is in radians, so use -3.14 to 3.14.

To get the angle to use, point your character in the direction then use the following command with the commandline script.

Code: Select all

player:update() print(player.Direction)
or you could just use trial and error.

The camera class doesn't save it's angle so you can't get it's angle. Note: camera:setRotation doesn't allow you to set the y angle.

Re: Camera position

Posted: Mon Feb 09, 2015 9:29 am
by Braziliano
what about objects instead of npcs? , or would it be better just to aim at a specific coordinates..

Re: Camera position

Posted: Mon Feb 09, 2015 11:32 am
by rock5
Objects should work fine too. The aimTo function just needs a table with X, Z and Y values. So objects, players, mobs and npcs will work.