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 Flamesilver · Sep 13, 2013 at 01:44 PM · javascriptc# to javascript

How to use Farseer Physics (C# Package) in Javascript?

I've downloaded Farseer Physics for Unity and imported it into a new project. Farseer is a C# / Unity port of a 2D physics engine based on Box2D.

There are many new classes such as Fixture and Body, but I cannot declare them in Javascript like:

var fixture :Fixture; // does not work.

Please help.

Comment
Add comment · Show 9
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 Will Davis · Sep 13, 2013 at 02:24 PM 0
Share

I have used Farseer but only with c#, presumably it could be related to Script compilation order issue. You could try putting all the farseer related stuff into a folder called plugins

avatar image ArkaneX · Sep 13, 2013 at 02:25 PM 0
Share

As a side note, I wonder why this was downvoted...

avatar image Flamesilver · Sep 14, 2013 at 12:27 AM 0
Share

Thank you for your help. I will try it when I get home and let you know.

I think it was downvoted because I asked a separate question yesterday about whether or not it's even possible to use Farseer in Javascript ins$$anonymous$$d of C#. I figured it's a different question, so I'd ask it in a different "Question."

avatar image Flamesilver · Sep 14, 2013 at 05:00 AM 0
Share

Ok... I've been looking at google for hours trying to figure out where "Standard Assets" is since my project folder didn't have one. I made one inside the project folder myself after importing the package and when I tried to create components from the editor it just didn't work. $$anonymous$$ept throwing errors.

Am I missing something?

avatar image Flamesilver · Sep 14, 2013 at 07:06 AM 0
Share

The exact error I'm getting is "...

Instance of FSShapeCpEditor couldn't be created. The script class needs to derive from ScriptableObject and be placed in the Assets/Editor folder.

'''"

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ArkaneX · Sep 13, 2013 at 02:24 PM

I'm unable to download this package at the moment, but I was able to look at the oldest GitHub version, and classes there are in namespaces. If classes in Asset Store version are in namespaces as well, and I think they are, then you have to import namespace first. For example, both Fixture and Body are in namespace FarseerPhysics.Dynamics, so you need

 import FarseerPhysics.Dynamics;

on top of your script.

In addition, if this package is not imported into Standard Assets folder (or any other folder which is compiled before your main scripts), then you can't access C# classes from JavaScript by default. To fix it, package content has to be moved to Standard Assets or Plugins folder.

EDIT: converted to answer.

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

17 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

NGUI Change animation method 2 Answers

My Health Script Won't work in C# 1 Answer

How to use Android Dual Joysticks? 1 Answer

Using PlayerPrefs to transfer variables from Javascript to C# 1 Answer

Unity reboots my computer 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