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 » Scripters
Home Search
 

Re: How would I check if the camera is angled too far?

Previous Thread :: Next Thread 
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 05:41 PM
Sorta like:

local Angles = camera.CoordinateFrame-camera.CoordinateFrame.p
if math.rad(Angles.Y) > 70 then
print('too far')
end


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2015 05:45 PM
local cframe = camera.CoordinateFrame;
local yAngle = math.asin(select(cframe:components(), 6));
if math.deg(yAngle) > 70 then
print('too far');
end


Range of asin is -pi/2 -> pi/2 (-90 deg to 90 deg)
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 05:47 PM
Ty cnt. But one more thing: how do I make it if yAngle > 70 then the yAngle reverts to 70


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2015 05:50 PM
The way I'm thinking of right now is very disgusting and inefficient, wait for someone who knows what they're doing to come along.
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 05:51 PM
Well, I guess there is another way I could do it. Can you help me with some trig? (I made a thread earlier. Got no help so I decided to see if anyone knew how to do it this way.)


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
heavylifterman192 is not online. heavylifterman192
Joined: 18 Oct 2015
Total Posts: 201
10 Nov 2015 05:52 PM
I don't think there is a way,

local cframe = camera.CoordinateFrame;
local yAngle = math.asin(select(cframe:components(), 6));
if math.deg(yAngle) > 70 then
game:service'Players'.LocalPlayer.Character.Humanoid.Health = 0
end
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
10 Nov 2015 05:53 PM
custom camera



Instance.new("BodyVelocity",SenseiWarrior).velocity = CFrame.new(SenseiWarrior.Torso.Position,YourGirlsDMs.Position).lookVector * 10
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 05:53 PM
@heavy
disgusting
its an fps, and whenever they look up, "oops" too far, im dead

>get no visits because i took your advice

yea, no, i will wait for cnt


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
heavylifterman192 is not online. heavylifterman192
Joined: 18 Oct 2015
Total Posts: 201
10 Nov 2015 05:56 PM
He said there is no way, you could put a part on your head in a specific way I guess...
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 05:56 PM
He did not say there is no way.


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2015 05:57 PM
I never said there was no way moron, I said the way I'm thinking of is an ugly way to do it.
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 05:58 PM
@cnt

please tell the peasant (me) how to do it the inefficient way
I will replace it once I get a better method.


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2015 06:01 PM
Get the current angles of the camera, check if the y angle is greater than 70, if so reset the rotation and in place put the current angles and clamp the y-angle from -70, 70
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 06:02 PM
cnt i know you already said this but

inefficient
gross
time consuming
idk how

me need better method :c


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
deadmilk is not online. deadmilk
Joined: 02 Nov 2015
Total Posts: 112
10 Nov 2015 06:02 PM
yikes
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
10 Nov 2015 06:14 PM
Is this first person only?
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 06:38 PM
Yes


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
10 Nov 2015 06:50 PM
local camera = workspace.CurrentCamera
local global_Y = Vector3.new(0,1)
local upperBound = math.rad(20)
game:GetService("RunService").RenderStepped:connect(function()
if camera.CoordinateFrame.lookVector:Dot(global_Y) > math.cos(upperBound) then
local x_axis = (camera.CoordinateFrame.lookVector:Cross(global_Y)).unit
local z_axis = (CFrame.fromAxisAngle(x_axis, -upperBound)*-global_Y).unit
local y_axis = (z_axis:Cross(x_axis)).unit
camera.CoordinateFrame = CFrame.new(0,0,0,
x_axis.X, y_axis.X, z_axis.X,
x_axis.Y, y_axis.Y, z_axis.Y,
x_axis.Z, y_axis.Z, z_axis.Z
)+camera.CoordinateFrame.p
end
end)
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
10 Nov 2015 07:06 PM
@Casual

I'm not too sure that you can use two numbers in a Vector3
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 07:25 PM
@cginm
its the rotation matrix

from what i understand its like a normal 3 value, except they all get 3 values like so:

local cf = CFrame.new(
x1, x2, x3,
y1, y2, y3,
z1, z2, z3)


Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
10 Nov 2015 07:27 PM
@above

I'm talking about this part

local global_Y = Vector3.new(0,1)

not the cframe
Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
10 Nov 2015 07:27 PM
@Zaxerion

Good job, but you missed one tiny thing. They go

x1, y1,
x2, y2,
x3, y3,

And so on as columns. You can learn some cool tricks on my Wiki page: http://wiki.roblox.com/index.php?title=User:MrNicNac/CFrame_Cheat_Sheet
Report Abuse
nox7 is not online. nox7
Joined: 29 Aug 2008
Total Posts: 27467
10 Nov 2015 07:27 PM
@cgjnm

"local global_Y = Vector3.new(0,1)"

Is fine and will work. When you do not give the final value to Vector3's new() function, it fills it as a zero.
Report Abuse
Zaxerion is not online. Zaxerion
Joined: 09 Feb 2013
Total Posts: 2304
10 Nov 2015 07:28 PM
@nox7

Thanks! I am still learning, and that actually cleared that up for me.
^I must mention that is sad because I am still learning after about 3 years :( I am dumb.

Hello, I am Zaxerion. I like to make cool things to show off in Script Builder!
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
10 Nov 2015 07:28 PM
So if I were to say Vecotr3.new(10)

would it be the same as Vector3.new(10,0,0)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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