Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Camera manipulation and movement?

Asked by 6 years ago

I know I titled this as "Camera manipulation and movement" so you can answer the question if you like. I only had that because the site would not allow me to use my original title. The real question I want answered is: How do you learn about functionality that you do understand?

During my quest to develop a game to my satisfaction, I have stumbled across some problems. I don't know how to manipulate object's movements. I tried to look up tutorials on YouTube and read the API but nothing was helpful. The tutorials were old and weren't up to date with the current roblox updates and the API was helpful in giving me the tools but does not explain how to use them.

This got me wondering: how do you learn to do new things?

I know how to script in Lua and understand principles of scripting in general, but when it comes to people/documents to help you understand a new topic or class, there is nothing to be found from the roblox community.

Specifically, I don't know how to do movements, use CFrame and Vector3, do camera manipulation and interpolation and use Gyro and forces.

Part of the reason I think I can't look at the API and understand how to do use the functions and properties is because I don't understand how things work in Studio. For example, I want to make the player look through the sight of a gun so I tried making an invisible part and setting the default workspace camera's CFrame to that part. Apparently I can't and it just rotates the player.

Does this question make any sense? I tried to make it general and give specific examples to help show what I mean...

0
why is this site so strict? must have proof of roblox account, must have question mark in title at the end, must have a very specific title... fa_QURobloxXD 29 — 6y

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

To be able to manipulate the camera CFrame with scripts, you have to set the CameraType to Scriptable. For example, when you want to set move it to a part:

local Cam = workspace.CurrentCamera
local Sight = script.Parent.Sight --change to sight part
local function UseSight()
    Cam.CameraType = Enum.CameraType.Scriptable
    Cam.CFrame = Sight.CFrame
end

--when you want to use the sight:
UseSight()

As for how you learn new things, I find that exploring the API properties can help. For example, this page identifies all the CameraTypes along with what each one does.

0
Thanks for the help. I have already manually set the CameraType to Scriptable by going to the Properties and manually setting it that way. The main question is still not answered though. Looking at API does not tell me the 'side effects' in a script or out. For example, while I can code with CFrames, I did not know multiplying a positional one with rotational will create a new one. Things likethat fa_QURobloxXD 29 — 6y
0
You just have to learn to understand the wiki (possibly as well as some up-to-date youtube tutorials and getting help here/on the discord). For the CFrame example, it tells you what multiplying CFrames does here: http://wiki.roblox.com/index.php?title=CFrame#CFrame_.2A_CFrame mattscy 3725 — 6y
Ad

Answer this question