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: trigonometry

Previous Thread :: Next Thread 
veryawesomeboy is not online. veryawesomeboy
Joined: 21 May 2013
Total Posts: 479
09 Aug 2017 11:14 AM
I'll pay 1k robux for someone to give me a complete tutorial on all of that stuff and its use in object/camera manipulation


Report Abuse
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
09 Aug 2017 11:23 AM
First off, why pay when you can go to high school, khan academy, or read books on it.

Secondly, what do you need to use trig for?

Report Abuse
veryawesomeboy is not online. veryawesomeboy
Joined: 21 May 2013
Total Posts: 479
09 Aug 2017 11:26 AM
The last time I checked, school does not start in the summer. I also don't have trig books lying around. Khan Academy is boring in my opinion. "What do you need to use trig for?" Read original post.


Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
09 Aug 2017 11:26 AM
Most high schools offer a trig course. Here, you have to take Alg 1, 2, and geom before you can, though.
Report Abuse
veryawesomeboy is not online. veryawesomeboy
Joined: 21 May 2013
Total Posts: 479
09 Aug 2017 11:28 AM
I'm entering 7th grade and I've taken Alg 1 and 2 and a bit of geo but I really haven't gotten the hang of trig .-.


Report Abuse
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
09 Aug 2017 11:28 AM
You said you want to learn trig for object/camera manipulation.

Are you simply planning to learn trig for future reference, or do you need it so that you can fix a problem you're having?

Report Abuse
dude10000009 is not online. dude10000009
Joined: 23 Nov 2010
Total Posts: 809
09 Aug 2017 11:28 AM
How haven;t you learnt trig yet !

Anyway, use google, thank me later, or now idc


Report Abuse
ahwz is not online. ahwz
Joined: 01 Apr 2010
Total Posts: 3230
09 Aug 2017 11:29 AM
sohcahtoa

1k pls


Report Abuse
veryawesomeboy is not online. veryawesomeboy
Joined: 21 May 2013
Total Posts: 479
09 Aug 2017 11:30 AM
I wanna know trig because I'm learning advanced scripting and it would be nice to have that up my sleeve. Sometimes I see scripts with #### ## it but I have no idea how it works .-. I know sin cos and tan but nothing much after that
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
09 Aug 2017 11:30 AM
lmao sohcahtoa
Report Abuse
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
09 Aug 2017 11:30 AM
I doubt anyone on here teaches trig. Use Khan academy

Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
09 Aug 2017 11:34 AM
sohcahtoa

also; you can't just be like "I want someone to teach me trigonometry for 1k robux" and expect someone to spend all that time for you.

look into phantom forces' cframe scripts or some other game. there's a lot of math in there.


Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan
Report Abuse
veryawesomeboy is not online. veryawesomeboy
Joined: 21 May 2013
Total Posts: 479
09 Aug 2017 11:35 AM
how would i be able to understand that .-.


Report Abuse
s3vvy is not online. s3vvy
Joined: 24 Feb 2011
Total Posts: 983
09 Aug 2017 11:36 AM
long story short; you can't learn trigonometry in a week or without spending a lot of time unless you have some photographic memory.

i don't know how you learned algebra 1 or 2 without knowing this fact..


Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan
Report Abuse
veryawesomeboy is not online. veryawesomeboy
Joined: 21 May 2013
Total Posts: 479
09 Aug 2017 11:38 AM
well algebra 1 and 2 dont have #### ## it
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
09 Aug 2017 11:39 AM
look up egomoose tutorials on youtube and on the wiki
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
09 Aug 2017 11:43 AM
It's worth learning trigonometry well, but if Khan Academy is too boring, try BetterExplained.
Report Abuse
Sulfone is not online. Sulfone
Joined: 19 Aug 2010
Total Posts: 8046
09 Aug 2017 01:58 PM
I'll give an physics based example which may make it easier to understand from a non-triangle based direction. One way trigonometry is used is when you need to find a relative angle with position or velocity.

Since we have access to it (and I can't post diagrams on forum posts), I'll have the example be based on a part in Roblox. Insert an anchored wedge part into workspace. Place a ball on top of the wedge. Turn on CustomPhysicalProperties and set friction on both BasePlate and the part to 0, so the part doesn't lose velocity on its own. The relative angle the ball will be moving will be found.

To make the X, Z and total speed easily visible with no decimals, you can put this into the ball:
while wait(0.1) do
local v = script.Parent.Velocity
local speed = math.sqrt(v.X^2+v.Z^2)
print(
'X:', math.floor(v.X+0.5),
'Z:', math.floor(v.Z+0.5),
'Speed:', math.floor(speed+0.5)
)
end

Now run the place. If the output doesn't show X to be positive and Z to be 0, keep rotating the part 90° and running the place until it does. For example, with my wedge the ball outputs "X: 23 Z: 0 Speed: 23". The positive X will be the direction we will compare later angles to. For reference place a CanCollide disabled line along where the ball goes right now.

Get a calculator (make sure it's in degrees mode) and put cos⁻¹(X/Speed) in. This is the angle between the line and the ball's current path. into it. Since X = Speed, X/Speed = 1 so the answer should be the same as cos⁻¹(1). The result is 0° and will be further explained later.

Now rotate the wedge by 90°, so Z velocity isn't 0 and X velocity becomes 0. Do cos⁻¹(X/Speed) with the new values. Since 0/Speed is 0, it's the same as cos⁻¹(0). This gives you 90°. The ball is moving 90° to the original line.

Next rotate the wedge so it's half-way between the 2 previous rotations and X = Z (and both are positive). Use cos⁻¹(X/Speed) with the new values again and you will notice it's close to 45° (if we used very exact values instead of the rounded ones, it would be exactly 45°).

You can do it for all rotation of the wedge and it you an angle from 0 to 180, ignoring the direction of rotation. This is obviously useful for finding the angle something is moving compared to something else. You can remove the math.floor+0.5 in the script if you want to do this with more precision.

To use cos⁻¹ (inverse cosine) in a script, math.acos() is used. This however is in radians, use math.deg to convert it to degrees. Add the following to the ball script's loop to have it output the angle automatically:
print(math.deg(math.acos(v.X/ speed)))

You can also do this in reverse. Multiply the expected speed by cos(angle) in the calculator to find the X velocity. Doing this can be useful for things like predicting distance travelled by a projectile.

These also work for position, force and acceleration.

How this works is because the X velocity and Z velocities can be drawn as 2 perpendicular lines, with their distances equal to their values. We can make a rectangle using 2 of these lines. The Speed can be represented by drawing another line from where the lines start to the other side of the rectangle. Measuring the angle of the Speed line from the X line will give you the angle the ball is going.

A half of the rectangle can be seen as a right angled triangle. For the angle the ball is going, the X line is the adjacent (A in CAH) and the Speed line is the hypotenuse (H in CAH). Since A and H is present, cosine is used (C in CAH):
cos(angle) = A/H
it can also be rearranged to find the angle:
angle = cos⁻¹(A/H)
or for the other example, to find A:
A = H*cos(angle)

The calculator or script was doing cos⁻¹(A/H) to find the angle based on A being the X velocity and H being the speed. Alternatively si​n⁻¹(O/H) with O being the Z velocity can find the angle relative to a Z direction. Similarly tan⁻¹(O/A) can be used to find an angle using only the X and Z velocities. Lua has a special version of tan⁻¹ known as math.atan2, which accepts the adjacent being 0.

I hope this was useful as an introduction to what trig can be used for and one way of visualising it.
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