generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Camera/Mouse

Previous Thread :: Next Thread 
VividSilence is not online. VividSilence
Joined: 21 Jul 2008
Total Posts: 1008
12 Mar 2014 12:20 PM
Is it possible to set camera focus or CameraSubject to mouse.X Position?

while wait() do
camera.CoordinateFrame = CFrame.new(p.Position)
camera.Focus = CFrame.new(game.Players.LocalPlayer:GetMouse().X)
end
--Says Vector3 Position needed :/
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
12 Mar 2014 12:23 PM
no because mouse.X is a float and you need a cframe
also you'd want to do
game:GetService("RunService").RenderStepped:connect(function()
--code
end
Report Abuse
VividSilence is not online. VividSilence
Joined: 21 Jul 2008
Total Posts: 1008
12 Mar 2014 12:41 PM
Okay, thank you.
Report Abuse
VividSilence is not online. VividSilence
Joined: 21 Jul 2008
Total Posts: 1008
12 Mar 2014 12:44 PM
I have this, but it when I turn the character by pressing a or s the head is out of focus.

p = Instance.new("Part", game.Players.LocalPlayer.Character)
p.Size = Vector3.new(1, 1, 1)
p.CanCollide = false
p.Transparency = 1
w = Instance.new("Weld", p)
w.Part1 = game.Players.LocalPlayer.Character.Head
w.C0 = CFrame.new(Vector3.new(-2, -2, -7))
w.Part0 = p

camera = game.Workspace.CurrentCamera
camera.CameraType = "Fixed"

game:GetService("RunService").RenderStepped:connect(function()
camera.CoordinateFrame = CFrame.new(p.Position)
camera.Focus = CFrame.new(game.Players.LocalPlayer.Character.Head.Position)
end)
Report Abuse
VividSilence is not online. VividSilence
Joined: 21 Jul 2008
Total Posts: 1008
12 Mar 2014 12:45 PM
*Turn by pressing a or d
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image