#Camera rotation

1 messages · Page 1 of 1 (latest)

shell gazelle
#

Is there a way to click an action and have the camera view be in front of the player and the click again to have the camera rotate back where it was?

haughty vale
#

Yes.

#

I will leave it as an exercise to the reader to implement it.

shell gazelle
#

I guess I might have to just wait until there's more documentation or code samples online

haughty vale
#

you can use a boolean to store the state

#

check the documentation

#

it should be sufficient

shell gazelle
#

there's nothing in the doc on camera free mode

#

is there a dev library for a ide that does autocomplete or something... like pycharm?

haughty vale
#

I can't find it in the docs either, which is really weird

#
shell gazelle
#

yeah, that's what i'm reading

#

i think what i want is something like a object attached to the player but in front and backward facing from 3rd person angle. the free mode makes it were the player just spins. what i want is the same as toggling the view in minecraft

haughty vale
shell gazelle
#

so cubzh can only have 1 camera, right?

haughty vale
#

the documentation says no

#

but code examples like the minimap world indicate otherwise

quick stone
#

it's possible to create several of them, but I couldn't tell you how, I think @fossil nebula succeeded in one of his projects

shell gazelle
#

okay, i think i figured it out...

#

toggle = Object()
toggle.Position = { Player.Position.X, Player.Position.Y+10, Player.Position.Z+10 }
toggle.Rotation = {0, -math.pi, 0}

World:AddChild(Player)
Player:AddChild(toggle)
#

by making it a child of the player, it appears to stay fixed in front, but facing the player. when i switch camera like this:

if toggleView then
    Camera:SetModeThirdPerson(toggle)
else
    Camera:SetModeThirdPerson(Player)
end

it appears to have the same movement but from the front

haughty vale
#

That’s a clever one, I would have overcomplicated it

fossil nebula
#

to create a new camera, just create it like an item: myCamera = Camera()

#

you can find more information into the minimap example world, it is not exactly the same use, but there is a sceond camera