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 Fattie · May 03, 2012 at 05:57 PM · javascripttrigger

Get a UserTrigger in Javascript - Eg for SmoothMoves

How the heck do you get a UserTrigger in Javascript ?

Anyone know? Thanks!


For the record, here is the exact Javascript to do this in SmoothMoves.

Note it is very very important to remember to call newTest.Play("one") .... do not accidentally call newTest.animation.Play("one") which is what you would be familiar with typing as a Unity developer. Of course, the latter will just call the "normal" animation of the object, and everything will go to hell, you very much want to call the actual SmoothMoves animation of the object!!

Here is the exact JS to register both SmoothMoves animations and SmoothMoves user-triggers. Thanks again Bérenger Mantoue !!!!!!

 #pragma strict
 
 import SmoothMoves;
 
 private var newTest:SmoothMoves.BoneAnimation;
 
 public function testeCollider(uTE:SmoothMoves.ColliderTriggerEvent):void
     { Debug.Log("the collider fired"); }
 
 public function testeUserTrigger(uTE:SmoothMoves.UserTriggerEvent):void
     { Debug.Log("the user-trigger fired"); }
 
 function Start ()
     {
     newTest = GameObject.Find("newTest").GetComponent(SmoothMoves.BoneAnimation);
     
     newTest.RegisterColliderTriggerDelegate(this.testeCollider);
     newTest.RegisterUserTriggerDelegate(this.testeUserTrigger);
     
     Debug.Log("I did register everything.");
     }
 
 function OnGUI()
     {
     if (GUI.Button (Rect (300,200,100,20), "play one"))
         newTest.Play("one");
     
     if (GUI.Button (Rect (420,200,100,20), "play two"))
         newTest.Play("two");
     }
Comment
Add comment · Show 8
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 Berenger · May 03, 2012 at 06:52 PM 0
Share

What do you mean a user trigger ?

avatar image GC1983 · May 03, 2012 at 07:00 PM 0
Share

do you mean IsTrigger?

avatar image Berenger · May 03, 2012 at 07:21 PM 0
Share

I don't see how it would be any different with javascript here, except obvious keywords (public void => function etc). Have you tried it ?

avatar image fafase · May 03, 2012 at 07:29 PM 0
Share

Actually I don't even see that UserTrigger button on my animation window,is that a pro feature?

avatar image Berenger · May 03, 2012 at 07:54 PM 0
Share

It's specific to smooth moves, a package from the asset store for 2D animation. I had never heard of it until today though.

Show more comments

1 Reply

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

Answer by Berenger · May 03, 2012 at 08:37 PM

Just to take it out of the unanswered :

The functions of registration are members of Smooth Moves' class BoneAnimation, thus available in both javascript and C#.

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 Fattie · May 04, 2012 at 08:35 AM 0
Share

one of the most magnificent answers ever seen on this forum ! thanks :)

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

6 People are following this question.

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

Related Questions

Delete certain gameobject if it enters the area. 1 Answer

Prevent instantiating on collider 1 Answer

Change scene with trigger collision not working. 1 Answer

How do you make a trig object? 0 Answers

Function OnTriggerEnder (difficult JavaScript) 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