Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by gsoft9999 · Mar 27, 2013 at 02:46 PM · mathfmathstrianglecos

triangles angles

Can any one tell me what calculation you have to make to calculate scalene triangles angles if you know all the lengths of the sides?

i am trying to make ik system that will suit my needs and i need to calculate the angles at which my bones should be but i need some angles. i looked on internet but i have no idea how to do all of that in script.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by fafase · Mar 27, 2013 at 02:50 PM

You have not search real well have you :)

The law of cosines is your answer.

Check there for instance.

http://www.mathsisfun.com/algebra/trig-cosine-law.html

Note that this is more of a math question than a unity question.

 float AngleOfTriangle(float a, float b, float c){
    float cAng = (a*a+b*b- c*c)/(2*a*b);
    float rad = Mathf.Acos(cAng);
    return Mathf.Rad2Deg(rad);
 }

In this case, the c angle represents the angle opposite to the last edge provided as parameter.

EDIT: I realized I made one mistake, it was given as a^a+b^b-c^c but it is a*a+b*b-c*c those are squared not power of itself. As requested in Js:

 function AngleOfTriangle:float(a:float , b:float, c:float){
    var cAng:float = (a*a+b*b- c*c)/(2*a*b);
    var rad:float = Mathf.Acos(cAng);
    return Mathf.Rad2Deg(rad);
 }

And it is "Can you PLEASE write this in Javascript?" :)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gsoft9999 · Mar 27, 2013 at 02:59 PM 0
Share

can you write that in javaScript?

avatar image gsoft9999 · Mar 27, 2013 at 03:05 PM 0
Share

thanks agian

avatar image gsoft9999 · Mar 27, 2013 at 03:13 PM 0
Share

sorry to bother you but i have some errors like: expecting (, found ':'. about 6 of them and does it change anything if im using unity 3.5?

avatar image fafase · Mar 27, 2013 at 03:25 PM 0
Share

What line? you could remove the :float. The version of Unity does not matter. I am a little rusty on Js...

so try with :

 function AngleOfTriangle(a:float , b:float, c:float)
 
avatar image
0

Answer by gsoft9999 · Mar 27, 2013 at 02:56 PM

thanks a lot!!! i was stuck on this for 5 hours

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fafase · Mar 27, 2013 at 02:59 PM 0
Share

Check that I modified since I found a mistake in my answer. Also, remove this as you are not answering but commenting my answer :).

avatar image
0

Answer by gsoft9999 · Mar 27, 2013 at 03:37 PM

 function AngleOfTriangle (a:float , b:float, c:float): float{
    var cAng:float = (a*a+b*b-c*c)/(2*a*b);
    var rad:float = Mathf.Acos(cAng);
    return Mathf.Rad2Deg*rad;
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Mathematicle error help 1 Answer

Trigonometry help? 1 Answer

Unity won't show my programatically created Mesh(A Simple Triangle) 2 Answers

Implementing mathf ? 1 Answer

How do I find the inverse cosine ??? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges