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 ownerfate · Jul 31, 2013 at 08:34 PM · prefabfbxenemy airigged

[CLOSED] How could i use 2 or more Prefabbed .FBX model animations in my "Chase Player" Script?

this is a small problem i am encountering but can't seem to find the right way to do it.

at the current moment i have two animations that i have prefabbed called "deathStalkerIdle" and "deathStalkerRun" each prefab is a rigged model of the AI.

when my player comes into range the model, it will advance towards the player and when a certain length away, it will stop.

to the point: Play the running prefab animation when player is in range. and play idle prefab animation when player is not.

this is a script i found on the unity forum, which is much better than the one i did. I forgot who wrote this, but i will give them credit for the script.

 // This is the object to follow
 
 var leader : Transform; 
 // This is the object which follows
 var follower : Transform; 
 // This is the speed with which the follower will pursue
 var speed : float = 2.0;
 // This is the range at which to pursue
 var chaseRange : float = 10.0;
 // This is used to store the distance between the two objects.
 private var range : float; 
 
 var runPrefab : Rigidbody;
 
 function Update(){ 
 
    // Calculate the distance between the follower and the leader.
 
    range = Vector3.Distance( follower.position,leader.position );
 
    if ( range <= chaseRange )
    {
       // If the follower is close enough to the leader, then chase!
       
       follower.LookAt(leader); 
       follower.Translate( speed * Vector3.forward * Time.deltaTime); 
 
  
 
    } // End if (range <= chaseRange) 
 
     
 
    else { 
 
  
 
       // The follower is out of range. Do nothing.
 
       return;
 
  
 
    } // End else (if ( range <= chaseRange ))
 
  
 
 } // End function Update()

if anyone has any ideas on how i can do this, i will greatly appreciate it.

Thanks

  • Ownerfate

Comment
Add comment · Show 3
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 rowdyp · Jul 31, 2013 at 09:37 PM 0
Share

did you split the animations in the fbx importer?

avatar image ownerfate · Aug 01, 2013 at 02:15 AM 0
Share

yes,they are 2 different animations.

avatar image ownerfate · Oct 01, 2013 at 11:53 AM 0
Share

i can close this question down because, yesterday i just used animations, triggers and instantiate scripts to get the effect i needed.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ownerfate · Feb 20, 2015 at 02:24 PM

Good god, i forgot about this ... beast of a horrid script...

i scrapped that whole system and brought in one that was MUCH smoother and doesn't include prefabbing.

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

16 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

Related Questions

Importing a model without it becoming a prefab 3 Answers

How to create prefab from a GameObject variable in class? 0 Answers

Updating a prefab fbx or animation while using version-control is broken 4 Answers

Unity FBX to Prefab Position reseting 1 Answer

Can't add components to imported FBX 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